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) => {
}
const canMakeDecisionStatuses = ['submitted', 'pendingApproval']
export const canMakeDecision = (state, collection = {}, fragment = {}) => {
if (get(fragment, 'id', '') !== last(get(collection, 'fragments', [])))
return false
export const canMakeDecision = (state, collection = {}) => {
const status = get(collection, 'status', 'draft')
const isEIC = currentUserIs(state, 'adminEiC')
......@@ -409,18 +407,6 @@ export const getOwnSubmittedRecommendation = (state, fragmentId) =>
)
.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 = {}) => {
const userId = get(state, 'currentUser.user.id')
const fragmentAuthors = chain(fragment)
......
......@@ -199,13 +199,14 @@ const ManuscriptLayout = ({
/>
)}
{get(currentUser, 'permissions.canSubmitRevision', false) && (
<SubmitRevision {...submitRevision} />
)}
{isLatestVersion &&
get(currentUser, 'permissions.canSubmitRevision', false) && (
<SubmitRevision {...submitRevision} />
)}
{get(currentUser, 'permissions.canMakeHERecommendation', false) &&
(!invitationsWithReviewers.length ||
reviewerRecommendations.length > 0) && (
{isLatestVersion &&
get(currentUser, 'permissions.canMakeHERecommendation', false) &&
reviewerRecommendations.length > 0 && (
<HERecommendation
formValues={get(formValues, 'editorialRecommendation', {})}
hasReviewerReports={reviewerRecommendations.length > 0}
......@@ -217,16 +218,17 @@ const ManuscriptLayout = ({
/>
)}
{get(currentUser, 'permissions.canMakeDecision', false) && (
<ManuscriptEicDecision
collection={collection}
formValues={get(formValues, 'eicDecision')}
highlight={editorialRecommendations.length > 0}
messagesLabel={messagesLabel}
mt={2}
submitDecision={recommendationHandler.createRecommendation}
/>
)}
{isLatestVersion &&
get(currentUser, 'permissions.canMakeDecision', false) && (
<ManuscriptEicDecision
collection={collection}
formValues={get(formValues, 'eicDecision')}
highlight={editorialRecommendations.length > 0}
messagesLabel={messagesLabel}
mt={2}
submitDecision={recommendationHandler.createRecommendation}
/>
)}
</Fragment>
) : (
<Text>Loading...</Text>
......
......@@ -176,7 +176,7 @@ export default compose(
canInviteReviewers: canInviteReviewers(state, collection),
canMakeRecommendation: !isUndefined(pendingOwnRecommendation),
canMakeRevision: canMakeRevision(state, collection, fragment),
canMakeDecision: canMakeDecision(state, collection, fragment),
canMakeDecision: canMakeDecision(state, collection),
canEditManuscript: canEditManuscript(state, collection, fragment),
canViewReviewersDetails: canViewReviewersDetails(state, collection),
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