From 46a23da9748c11b12873476c532a78da67b6c329 Mon Sep 17 00:00:00 2001 From: Mihail Hagiu <mihail.hagiu@thinslices.com> Date: Wed, 12 Dec 2018 14:32:51 +0200 Subject: [PATCH] feat(InviteReviewersContextualBox): EiC cannot invite reviewers anymore (frontend) --- .../component-faraday-selectors/src/index.js | 2 ++ .../component-faraday-ui/src/ReviewersTable.js | 16 +++++++++------- .../src/contextualBoxes/ReviewerDetails.js | 12 +++++++++--- .../src/components/ManuscriptPage.js | 2 ++ 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/packages/component-faraday-selectors/src/index.js b/packages/component-faraday-selectors/src/index.js index 40e8640c8..d51783f14 100644 --- a/packages/component-faraday-selectors/src/index.js +++ b/packages/component-faraday-selectors/src/index.js @@ -115,6 +115,8 @@ export const authorCanViewReportsDetails = ( ) } +export const canInviteReviewersAsEiC = state => !currentUserIs(state, 'isEiC') + export const reviewersCanViewReviewerReports = ( state, collection = {}, diff --git a/packages/component-faraday-ui/src/ReviewersTable.js b/packages/component-faraday-ui/src/ReviewersTable.js index e2197d20c..6d0ce3600 100644 --- a/packages/component-faraday-ui/src/ReviewersTable.js +++ b/packages/component-faraday-ui/src/ReviewersTable.js @@ -8,6 +8,7 @@ import { compose, shouldUpdate, withHandlers, withProps } from 'recompose' import { Label, PersonInvitation, Text } from '../' const ReviewersTable = ({ + currentUser, invitations, getInvitationStatus, renderAcceptedLabel, @@ -70,13 +71,14 @@ const ReviewersTable = ({ </DateParser> </td> <HiddenCell> - {!invitation.hasAnswer && ( - <PersonInvitation - {...invitation} - onResend={onResendReviewerInvite} - onRevoke={onRevokeReviewerInvite} - /> - )} + {!invitation.hasAnswer && + get(currentUser, 'permissions.canInviteReviewersAsEiC') && ( + <PersonInvitation + {...invitation} + onResend={onResendReviewerInvite} + onRevoke={onRevokeReviewerInvite} + /> + )} </HiddenCell> </TableRow> ))} diff --git a/packages/component-faraday-ui/src/contextualBoxes/ReviewerDetails.js b/packages/component-faraday-ui/src/contextualBoxes/ReviewerDetails.js index 987aa4a77..d10e50c77 100644 --- a/packages/component-faraday-ui/src/contextualBoxes/ReviewerDetails.js +++ b/packages/component-faraday-ui/src/contextualBoxes/ReviewerDetails.js @@ -26,6 +26,7 @@ const ReviewerDetails = ({ reports = [], fragment, invitations, + currentUser, publonReviewers, isFetching, previewFile, @@ -41,6 +42,7 @@ const ReviewerDetails = ({ highlight, canViewReviewersDetails, authorCanViewReportsDetails, + canSeeReviewerSuggestionsTab, isLatestVersion, ...rest }) => ( @@ -65,7 +67,8 @@ const ReviewerDetails = ({ <H4>Reviewer Details</H4> </TabButton> {canInviteReviewers && - isLatestVersion && ( + isLatestVersion && + get(currentUser, 'permissions.canSeeReviewerSuggestionsTab') && ( <TabButton data-test-id="reviewer-tab-suggestions" ml={1} @@ -91,7 +94,8 @@ const ReviewerDetails = ({ {selectedTab === 0 && ( <Fragment> {canInviteReviewers && - isLatestVersion && ( + isLatestVersion && + get(currentUser, 'permissions.canInviteReviewersAsEiC') && ( <InviteReviewers modalKey="invite-reviewers" onInvite={onInviteReviewer} @@ -99,6 +103,7 @@ const ReviewerDetails = ({ )} <ReviewersTable + currentUser={currentUser} invitations={invitations} onResendReviewerInvite={onResendReviewerInvite} onRevokeReviewerInvite={onRevokeReviewerInvite} @@ -106,7 +111,8 @@ const ReviewerDetails = ({ </Fragment> )} {selectedTab === 2 && - isLatestVersion && ( + isLatestVersion && + get(currentUser, 'permissions.canInviteReviewersAsEiC') && ( <PublonsTable onInvite={onInvitePublonReviewer} publonsError={fetchingError} diff --git a/packages/component-manuscript/src/components/ManuscriptPage.js b/packages/component-manuscript/src/components/ManuscriptPage.js index 928d9077c..ee40454d7 100644 --- a/packages/component-manuscript/src/components/ManuscriptPage.js +++ b/packages/component-manuscript/src/components/ManuscriptPage.js @@ -49,6 +49,7 @@ import { isFetchingFromAutosave, canMakeHERecommendation, canViewReviewersDetails, + canInviteReviewersAsEiC, canViewEditorialComments, pendingReviewerInvitation, canViewResponseFromAuthor, @@ -196,6 +197,7 @@ export default compose( canMakeDecision: canMakeDecision(state, collection), canEditManuscript: canEditManuscript(state, collection, fragment), canViewReviewersDetails: canViewReviewersDetails(state, collection), + canInviteReviewersAsEiC: canInviteReviewersAsEiC(state), authorCanViewReportsDetails: authorCanViewReportsDetails( state, collection, -- GitLab