Skip to content
Snippets Groups Projects
Commit ed11f755 authored by Alexandru Munteanu's avatar Alexandru Munteanu
Browse files

Merge branch 'HIN-1080' into 'develop'

feat(manuscriptLayout): show make recommendation, submit revision only on latest version

See merge request !132
parents c7fada40 7466742a
No related branches found
No related tags found
2 merge requests!136Sprint 22 features (updates),!132feat(manuscriptLayout): show make recommendation, submit revision only on latest version
...@@ -199,9 +199,7 @@ export const getHERecommendation = (state, collectionId, fragmentId) => { ...@@ -199,9 +199,7 @@ export const getHERecommendation = (state, collectionId, fragmentId) => {
} }
const canMakeDecisionStatuses = ['submitted', 'pendingApproval'] const canMakeDecisionStatuses = ['submitted', 'pendingApproval']
export const canMakeDecision = (state, collection = {}, fragment = {}) => { export const canMakeDecision = (state, collection = {}) => {
if (get(fragment, 'id', '') !== last(get(collection, 'fragments', [])))
return false
const status = get(collection, 'status', 'draft') const status = get(collection, 'status', 'draft')
const isEIC = currentUserIs(state, 'adminEiC') const isEIC = currentUserIs(state, 'adminEiC')
...@@ -409,18 +407,6 @@ export const getOwnSubmittedRecommendation = (state, fragmentId) => ...@@ -409,18 +407,6 @@ export const getOwnSubmittedRecommendation = (state, fragmentId) =>
) )
.value() .value()
const canMakeRecommendationStatuses = [
'heAssigned',
'underReview',
'reviewCompleted',
]
export const canMakeRecommendation = (state, collection, fragment = {}) => {
if (fragment.id !== last(get(collection, 'fragments', []))) return false
const isHE = isHEToManuscript(state, get(collection, 'id', ''))
const status = get(collection, 'status', 'draft')
return isHE && canMakeRecommendationStatuses.includes(status)
}
export const canSubmitRevision = (state, fragment = {}) => { export const canSubmitRevision = (state, fragment = {}) => {
const userId = get(state, 'currentUser.user.id') const userId = get(state, 'currentUser.user.id')
const fragmentAuthors = chain(fragment) const fragmentAuthors = chain(fragment)
......
...@@ -199,13 +199,14 @@ const ManuscriptLayout = ({ ...@@ -199,13 +199,14 @@ const ManuscriptLayout = ({
/> />
)} )}
{get(currentUser, 'permissions.canSubmitRevision', false) && ( {isLatestVersion &&
<SubmitRevision {...submitRevision} /> get(currentUser, 'permissions.canSubmitRevision', false) && (
)} <SubmitRevision {...submitRevision} />
)}
{get(currentUser, 'permissions.canMakeHERecommendation', false) && {isLatestVersion &&
(!invitationsWithReviewers.length || get(currentUser, 'permissions.canMakeHERecommendation', false) &&
reviewerRecommendations.length > 0) && ( reviewerRecommendations.length > 0 && (
<HERecommendation <HERecommendation
formValues={get(formValues, 'editorialRecommendation', {})} formValues={get(formValues, 'editorialRecommendation', {})}
hasReviewerReports={reviewerRecommendations.length > 0} hasReviewerReports={reviewerRecommendations.length > 0}
...@@ -217,16 +218,17 @@ const ManuscriptLayout = ({ ...@@ -217,16 +218,17 @@ const ManuscriptLayout = ({
/> />
)} )}
{get(currentUser, 'permissions.canMakeDecision', false) && ( {isLatestVersion &&
<ManuscriptEicDecision get(currentUser, 'permissions.canMakeDecision', false) && (
collection={collection} <ManuscriptEicDecision
formValues={get(formValues, 'eicDecision')} collection={collection}
highlight={editorialRecommendations.length > 0} formValues={get(formValues, 'eicDecision')}
messagesLabel={messagesLabel} highlight={editorialRecommendations.length > 0}
mt={2} messagesLabel={messagesLabel}
submitDecision={recommendationHandler.createRecommendation} mt={2}
/> submitDecision={recommendationHandler.createRecommendation}
)} />
)}
</Fragment> </Fragment>
) : ( ) : (
<Text>Loading...</Text> <Text>Loading...</Text>
......
...@@ -176,7 +176,7 @@ export default compose( ...@@ -176,7 +176,7 @@ export default compose(
canInviteReviewers: canInviteReviewers(state, collection), canInviteReviewers: canInviteReviewers(state, collection),
canMakeRecommendation: !isUndefined(pendingOwnRecommendation), canMakeRecommendation: !isUndefined(pendingOwnRecommendation),
canMakeRevision: canMakeRevision(state, collection, fragment), canMakeRevision: canMakeRevision(state, collection, fragment),
canMakeDecision: canMakeDecision(state, collection, fragment), canMakeDecision: canMakeDecision(state, collection),
canEditManuscript: canEditManuscript(state, collection, fragment), canEditManuscript: canEditManuscript(state, collection, fragment),
canViewReviewersDetails: canViewReviewersDetails(state, collection), canViewReviewersDetails: canViewReviewersDetails(state, collection),
authorCanViewReportsDetails: authorCanViewReportsDetails( authorCanViewReportsDetails: authorCanViewReportsDetails(
......
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