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

feat(eic-decision): show make decision only to admin and eic

parent 2d5346bc
No related branches found
No related tags found
1 merge request!10Sprint #12
......@@ -16,3 +16,19 @@ export const canMakeRecommendation = (state, project) => {
const isHE = isHEToManuscript(state, project.id)
return isHE && get(project, 'status') === 'reviewCompleted'
}
export const currentUserIs = ({ currentUser }, role) => {
const isAdmin = get(currentUser, 'admin')
const isEic = get(currentUser, 'editorInChief')
const isHe = get(currentUser, 'handlingEditor')
switch (role) {
case 'isHE':
return isHe
case 'staff':
return isAdmin || isEic || isHe
case 'adminEiC':
return isAdmin || isEic
default:
return false
}
}
......@@ -14,11 +14,13 @@ import { AuthorsWithTooltip } from 'pubsweet-component-manuscript/src/molecules'
import ZipFiles from '../Files/ZipFiles'
import { InviteReviewers } from '../Reviewers/'
import { currentUserIs } from '../../redux/users'
import { selectInvitation } from '../../redux/reviewers'
import { ReviewerDecision, HandlingEditorSection } from './'
import { parseVersion, parseJournalIssue, mapStatusToLabel } from './../utils'
import { canMakeRecommendation } from '../../../../component-faraday-selectors/src'
import {
currentUserIs,
canMakeRecommendation,
} from '../../../../component-faraday-selectors/src'
import { Decision } from '../MakeDecision'
import { ReviewerBreakdown } from '../Invitations'
......@@ -26,6 +28,7 @@ import { Recommendation } from '../MakeRecommendation'
const DashboardCard = ({
isHE,
isEIC,
theme,
journal,
history,
......@@ -63,12 +66,14 @@ const DashboardCard = ({
/>
</LeftDetails>
<RightDetails flex={2}>
<Decision
collectionId={project.id}
fragmentId={version.id}
heRecommendation={heRecommendation}
modalKey={`decide-${version.id}`}
/>
{isEIC && (
<Decision
collectionId={project.id}
fragmentId={version.id}
heRecommendation={heRecommendation}
modalKey={`decide-${version.id}`}
/>
)}
{canMakeRecommendation && (
<Recommendation
collectionId={project.id}
......@@ -125,7 +130,7 @@ const DashboardCard = ({
}
>
Details
<Icon color={theme.colorPrimary}>chevron-right</Icon>
<Icon primary>chevron-right</Icon>
</Details>
) : (
<Details
......@@ -189,6 +194,7 @@ export default compose(
modalComponent: ConfirmationModal,
}),
connect((state, { project }) => ({
isEIC: currentUserIs(state, 'adminEiC'),
isHE: currentUserIs(state, 'handlingEditor'),
invitation: selectInvitation(state, project.id),
canMakeRecommendation: canMakeRecommendation(state, project),
......
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