Skip to content
Snippets Groups Projects
Commit 34229900 authored by Sebastian Mihalache's avatar Sebastian Mihalache
Browse files

Merge branch 'submit-revision' of gitlab.coko.foundation:xpub/xpub-faraday into submit-revision

parents ea9458ca 283f7f17
No related branches found
No related tags found
2 merge requests!13Sprint #14,!11Submit revision
......@@ -16,8 +16,8 @@ import { selectInvitation } from '../../redux/reviewers'
import { ReviewerDecision, HandlingEditorSection, DeleteManuscript } from './'
import { parseVersion, parseJournalIssue, mapStatusToLabel } from './../utils'
import {
currentUserIs,
canMakeDecision,
isHEToManuscript,
canInviteReviewers,
canMakeRecommendation,
} from '../../../../component-faraday-selectors/src'
......@@ -147,6 +147,7 @@ const DashboardCard = ({
<LeftDetails flex={4}>
<HandlingEditorSection
currentUser={currentUser}
isHE={isHE}
project={project}
/>
</LeftDetails>
......@@ -187,8 +188,8 @@ export default compose(
getContext({ journal: PropTypes.object, currentUser: PropTypes.object }),
withTheme,
connect((state, { project, version }) => ({
isHE: currentUserIs(state, 'handlingEditor'),
canMakeDecision: canMakeDecision(state, project),
isHE: isHEToManuscript(state, get(project, 'id')),
canInviteReviewers: canInviteReviewers(state, project),
invitation: selectInvitation(state, get(version, 'id')),
canMakeRecommendation: canMakeRecommendation(state, project),
......
......@@ -4,11 +4,11 @@ import { th } from '@pubsweet/ui'
import styled, { css } from 'styled-components'
import { EditorInChiefActions, HandlingEditorActions } from './'
const renderHE = (currentUser, project) => {
const renderHE = (currentUser, isHE, project) => {
const status = get(project, 'status') || 'draft'
const isAdmin = get(currentUser, 'admin')
const isEic = get(currentUser, 'editorInChief')
const isHe = get(currentUser, 'handlingEditor')
const handlingEditor = get(project, 'handlingEditor')
const eicActionsStatuses = ['submitted', 'heInvited']
const heActionsStatuses = ['heInvited']
......@@ -22,7 +22,7 @@ const renderHE = (currentUser, project) => {
)
}
if (isHe && heActionsStatuses.includes(status)) {
if (isHE && heActionsStatuses.includes(status)) {
return (
<HandlingEditorActions
currentUser={currentUser}
......@@ -35,10 +35,10 @@ const renderHE = (currentUser, project) => {
return <AssignedHE>{get(handlingEditor, 'name') || 'N/A'}</AssignedHE>
}
const HandlingEditorSection = ({ currentUser, project }) => (
const HandlingEditorSection = ({ isHE, currentUser, project }) => (
<Root>
<HEText>Handling Editor</HEText>
{renderHE(currentUser, project)}
{renderHE(currentUser, isHE, project)}
</Root>
)
......
......@@ -147,6 +147,10 @@ async function authenticatedUser(user, operation, object, context) {
}
}
if (get(object, 'type') === 'user') {
return true
}
// allow HE to get reviewer invitations
if (get(object, 'fragment.type') === 'fragment') {
const collectionId = get(object, 'fragment.collectionId')
......@@ -224,6 +228,10 @@ async function authenticatedUser(user, operation, object, context) {
) {
return helpers.isHandlingEditor({ user, object })
}
if (get(object, 'type') === 'collection') {
return helpers.isOwner({ user, object })
}
}
// If no individual permissions exist (above), fallback to unauthenticated
......
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