Commit a813f07e authored by nickstiffler's avatar nickstiffler Committed by Yannis Barlas
Browse files

feat(reviewer panel): let curators submit after decision has been made

parent cae33366
......@@ -553,6 +553,7 @@ const CURATOR_PANEL = gql`
id
created
decision
submitted
curatorReviews(currentUserOnly: true) {
id
content
......
......@@ -102,10 +102,14 @@ const CuratorView = props => {
* Left side: preview
*/
const leftSections =
const submittedVersions =
previewData &&
previewData.manuscript &&
previewData.manuscript.versions.map((version, index) => ({
previewData.manuscript.versions.filter(v => v.submitted)
const leftSections =
submittedVersions &&
submittedVersions.map((version, index) => ({
key: version.id,
label: <Label created={version.created} index={index} />,
content: (
......@@ -113,7 +117,7 @@ const CuratorView = props => {
article={version}
exportManuscript={exportManuscriptToPrint}
manuscriptId={manuscriptId}
previousVersion={previewData.manuscript.versions[index - 1]}
previousVersion={submittedVersions[index - 1]}
showAdditionalData
showHeader={false}
/>
......@@ -149,9 +153,11 @@ const CuratorView = props => {
saveChat = message => saveToStorage(message, `chat_${chatThread.id}`)
getSavedChat = () => getFromStorage(`chat_${chatThread.id}`)
rightSections = versions.map((version, index) => {
const submittedPanelVersions = versions.filter(v => v.submitted)
rightSections = submittedPanelVersions.map((version, index) => {
const { decision, curatorReviews } = version
const latest = index === versions.length - 1
const latest = index === submittedPanelVersions.length - 1
// there can only be one review per curator per version
const thisReview = curatorReviews[0]
......@@ -192,11 +198,14 @@ const CuratorView = props => {
}
}
const canStillReview = latest && !submitted
return {
key: version.id,
label: <Label created={version.created} index={index} />,
content: (
<ReviewerPanel
canStillReview={canStillReview}
dbReferenceId={dbReferenceId}
decision={decision}
doi={doi}
......
......@@ -192,11 +192,14 @@ const ReviewerView = props => {
}
}
const canStillReview = latest && !decision && !submitted
return {
key: version.id,
label: <Label created={version.created} index={index} />,
content: (
<ReviewerPanel
canStillReview={canStillReview}
decision={decision}
key={version.id}
makeOptions={makeOptions}
......
......@@ -59,6 +59,7 @@ class AutoSave extends React.Component {
const ReviewerPanel = props => {
const {
canStillReview,
dbReferenceId,
decision,
doi,
......@@ -76,7 +77,7 @@ const ReviewerPanel = props => {
} = props
const decisionExists = !!decision
if (decisionExists && !submitted)
if (!canStillReview)
return (
<Wrapper>
<Status status="error">
......@@ -224,6 +225,7 @@ const ReviewerPanel = props => {
const validDecisions = ['accept', 'reject', 'revise']
ReviewerPanel.propTypes = {
canStillReview: PropTypes.bool.isRequired,
dbReferenceId: PropTypes.string,
decision: PropTypes.oneOf(validDecisions),
doi: PropTypes.string,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment