Skip to content
Snippets Groups Projects
Commit 5670cdbd authored by Mihail Hagiu's avatar Mihail Hagiu
Browse files

fix(ReviewerEditorialComments): Reviewers can now see editorial comments

parent b8cc767d
No related branches found
No related tags found
1 merge request!121Hin 1043 fix
import { get, has, last, chain } from 'lodash'
import { get, has, last, chain, some } from 'lodash'
import { selectCurrentUser } from 'xpub-selectors'
export const isHEToManuscript = (state, collectionId = '') => {
......@@ -114,6 +114,7 @@ export const canEICViewEditorialComments = (state, collection = {}) => {
return isEIC && canEICViewEditorialCommentsStatuses.includes(status)
}
const decisionTakenStatuses = ['rejected', 'accepted', 'inQA']
const canReviewerViewEditorialCommentsStatuses = [
'underReview',
'reviewCompleted',
......@@ -127,15 +128,17 @@ export const canReviewerViewEditorialComments = (
) => {
const status = get(collection, 'status', 'draft')
const isReviewer = currentUserIsReviewer(state, get(fragment, 'id', ''))
const hasDecision = ['rejected', 'accepted', 'inQA'].includes(status)
const hasRevision = get(fragment, 'revision', false)
const hasDecision = decisionTakenStatuses.includes(status)
const fragmentVersion = fragment.version
const hasSubmission = some(state.fragments, f => f.version > fragmentVersion)
return (
isReviewer &&
(hasDecision ||
(hasRevision &&
(hasSubmission &&
canReviewerViewEditorialCommentsStatuses.includes(status)))
)
}
const cannotAuthorViewEditorialCommentsStatuses = [
'draft',
'technicalChecks',
......
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