Skip to content
Snippets Groups Projects

Hin 1153 status after review

Merged Andrei Cioromila requested to merge HIN-1153-status-after-review into develop
Files
10
import { selectCurrentUser } from 'xpub-selectors'
import { get, has, last, chain, some, isEmpty } from 'lodash'
// eslint-disable-next-line no-unused-vars
import { get, has, last, chain, some, isEmpty, flatten } from 'lodash'
export const isHEToManuscript = (state, collectionId = '') => {
const { id = '', isAccepted = false } = chain(state)
@@ -229,6 +230,34 @@ export const canMakeDecision = (state, collection = {}) => {
return isEIC && canMakeDecisionStatuses.includes(status)
}
const collectionReviewerReports = state =>
chain(state)
.get('fragments', {})
.map(r => get(r, 'recommendations', []))
.flatten()
.find(r => r.recommendationType === 'review' && r.submittedOn)
.value()
const cannotHEMakeRecommendationToPublishStatuses = ['heInvited']
export const canHEMakeRecommendationToPublish = (state, collection = {}) => {
const status = get(collection, 'status', 'draft')
return (
!!collectionReviewerReports(state) ||
cannotHEMakeRecommendationToPublishStatuses.includes(status)
)
}
const canHEOnlyRejectStatuses = [
'reviewersInvited',
'underReview',
'revisionRequested',
]
export const canHEOnlyReject = (collection = {}) => {
const { status } = collection
return canHEOnlyRejectStatuses.includes(status)
}
const canEditManuscriptStatuses = ['draft', 'technicalChecks', 'inQA']
export const canEditManuscript = (state, collection = {}, fragment = {}) => {
const isAdmin = currentUserIs(state, 'isAdmin')