Skip to content
Snippets Groups Projects
Commit 758b33d5 authored by Anca Ursachi's avatar Anca Ursachi
Browse files

fix(pullTaniaCommit): Handling editor should be 'Unassigned' until HE accepts...

fix(pullTaniaCommit): Handling editor should be 'Unassigned' until HE accepts invitation to edit Man
parents 77983610 71cb4f43
No related branches found
No related tags found
3 merge requests!176Sprint 24,!171Sprint 24,!168Hin 845 revoke and assign he fix
...@@ -76,7 +76,7 @@ const ManuscriptCard = ({ ...@@ -76,7 +76,7 @@ const ManuscriptCard = ({
<Row alignItems="center" justify="flex-start" mb={1}> <Row alignItems="center" justify="flex-start" mb={1}>
<H4>Handling editor</H4> <H4>Handling editor</H4>
<Text ml={1} mr={3} whiteSpace="nowrap"> <Text ml={1} mr={3} whiteSpace="nowrap">
{get(handlingEditor, 'name', 'Undefined')} {get(handlingEditor, 'name', 'Unassigned')}
</Text> </Text>
{canViewReports && ( {canViewReports && (
<Fragment> <Fragment>
......
...@@ -188,7 +188,7 @@ export default compose( ...@@ -188,7 +188,7 @@ export default compose(
</Button> </Button>
) )
} }
return <Text ml={1}>Assigned</Text> return <Text ml={1}>{handlingEditor.name}</Text>
}, },
}), }),
setDisplayName('ManuscriptHeader'), setDisplayName('ManuscriptHeader'),
......
...@@ -4,8 +4,6 @@ const { omit, get, last, chain } = require('lodash') ...@@ -4,8 +4,6 @@ const { omit, get, last, chain } = require('lodash')
const statuses = config.get('statuses') const statuses = config.get('statuses')
const keysToOmit = [`email`, `id`]
const authorCannotViewHENameStatuses = ['heInvited']
const authorAllowedStatuses = ['revisionRequested', 'rejected', 'accepted'] const authorAllowedStatuses = ['revisionRequested', 'rejected', 'accepted']
const getTeamsByPermissions = async ( const getTeamsByPermissions = async (
...@@ -102,21 +100,26 @@ const filterRecommendationsFromOlderVersions = (recommendations, user) => { ...@@ -102,21 +100,26 @@ const filterRecommendationsFromOlderVersions = (recommendations, user) => {
const stripeCollectionByRole = ({ collection = {}, role = '' }) => { const stripeCollectionByRole = ({ collection = {}, role = '' }) => {
if (role === 'author') { if (role === 'author') {
const { handlingEditor } = collection if (collection.status === 'heInvited') {
return {
if (authorCannotViewHENameStatuses.includes(collection.status)) { ...collection,
handlingEditor: {
name: 'Assigned',
},
}
}
if (collection.status === 'submitted') {
return { return {
...collection, ...collection,
handlingEditor: handlingEditor && handlingEditor: {
!handlingEditor.isAccepted && { name: 'Unssigned',
...omit(handlingEditor, keysToOmit), },
name: 'Assigned',
},
} }
} }
} }
return collection return collection
} }
const stripeFragmentByRole = ({ const stripeFragmentByRole = ({
fragment = {}, fragment = {},
role = '', role = '',
......
...@@ -93,8 +93,13 @@ async function applyAuthenticatedUserPolicy(user, operation, object, context) { ...@@ -93,8 +93,13 @@ async function applyAuthenticatedUserPolicy(user, operation, object, context) {
FragmentModel: context.models.Fragment, FragmentModel: context.models.Fragment,
}) })
const parsedCollection = helpers.stripeCollectionByRole({
collection,
role,
})
return { return {
...collection, ...parsedCollection,
...parsedStatuses, ...parsedStatuses,
fragments: fragments:
role !== 'reviewer' role !== 'reviewer'
......
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