Commit 6cfbc3a4 authored by nickstiffler's avatar nickstiffler Committed by Yannis Barlas

feat(reviewer panel): ask reviewer if they want to look at revision

parent 43ee9f53
......@@ -58,6 +58,7 @@ const GET_ARTICLE_FOR_EDITOR = gql`
id
displayName
}
askedToSeeRevision
status {
pending
submitted
......
......@@ -28,6 +28,7 @@ const GET_USER_REVIEWS_FOR_ARTICLE = gql`
content
created
openAcknowledgement
askedToSeeRevision
recommendation
status {
submitted
......
......@@ -9,19 +9,27 @@ const validations = yup.object().shape({
content: yup.string().required('Cannot leave review empty'),
openAcknowledgement: yup.boolean(),
recommendation: yup.string().required('You need to make a recommendation'),
askedToSeeRevision: yup.boolean(),
})
const ReviewForm = props => {
const { review, submitReview, ...rest } = props
// TO DO -- remove check when you start rendering form only when there is a review
let content, openAcknowledgement, recommendation
if (review) ({ content, openAcknowledgement, recommendation } = review)
let content, openAcknowledgement, recommendation, askedToSeeRevision
if (review)
({
content,
openAcknowledgement,
recommendation,
askedToSeeRevision,
} = review)
const initialValues = {
content: content || '',
openAcknowledgement: openAcknowledgement || false,
recommendation: recommendation || '',
askedToSeeRevision: askedToSeeRevision || false,
}
const handleSubmit = (values, formikBag) => {
......
......@@ -196,6 +196,16 @@ const Review = props => {
touched={touched}
/>
<Checkbox
checkBoxText="I would like to see the revised article"
checked={values.askedToSeeRevision}
name="askedToSeeRevision"
onChange={handleChange}
readOnly={submitted}
setFieldTouched={setFieldTouched}
touched={touched}
/>
{!submitted && (
<Button primary type="submit">
Submit
......
......@@ -77,6 +77,11 @@ const Acknowledgement = ({ open }) => {
return <StyledAcknowledgement open={open}>{text}</StyledAcknowledgement>
}
const showReviewerRevision = show =>
show
? 'Reviewer would like to see revision'
: 'Reviewer does not need to see revision'
const Review = props => {
const {
// articleVersionId,
......@@ -90,6 +95,7 @@ const Review = props => {
reviewer,
sendReviewerChatMessage,
status,
askedToSeeRevision,
} = props
// const pingReviewer = () => {
......@@ -125,6 +131,7 @@ const Review = props => {
<>
<Recommendation status={recommendation}>
recommendation: <span>{recommendation}</span>
<div>{showReviewerRevision(askedToSeeRevision)}</div>
</Recommendation>
<Editor readOnly value={content} />
</>
......
......@@ -306,6 +306,7 @@ const permissions = {
'openAcknowledgement',
'recommendation',
'status',
'askedToSeeRevision',
]
const changedFields = Object.keys(update)
const updateAllowedByWhitelist = arrayContains(whiteList, changedFields)
......
......@@ -20,6 +20,7 @@ type Review {
reviewerId: ID
reviewer: User
status: ReviewStatus
askedToSeeRevision: Boolean
}
type ReviewEvents {
......@@ -48,6 +49,7 @@ input SubmitReviewInput {
content: String
openAcknowledgement: Boolean
recommendation: String
askedToSeeRevision: Boolean
}
type ReviewForArticle {
......@@ -59,4 +61,5 @@ type ReviewForArticle {
recommendation: String
reviewer: User
status: ReviewStatus
askedToSeeRevision: Boolean
}
alter table only reviews
add column asked_to_see_revision boolean
;
const { Review } = require('@pubsweet/models')
exports.up = async knex => {
const reviews = await Review.query()
await Promise.all(
reviews.map(async review => {
if (review.status.submitted) {
await review.$query().patch({
askedToSeeRevision: false,
})
}
}),
)
}
......@@ -21,6 +21,7 @@ class Review extends BaseModel {
reviewerId: { type: 'string', format: 'uuid' },
recommendation: { type: 'string' },
openAcknowledgement: { type: 'boolean' },
askedToSeeRevision: { type: 'boolean' },
},
}
}
......
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