diff --git a/packages/component-faraday-ui/src/ManuscriptCard.js b/packages/component-faraday-ui/src/ManuscriptCard.js index fb471ea96a51267573dcf00e32d8fe422379b18d..17e9e176354403406b6066cf5b09f589a9a93cfa 100644 --- a/packages/component-faraday-ui/src/ManuscriptCard.js +++ b/packages/component-faraday-ui/src/ManuscriptCard.js @@ -76,7 +76,7 @@ const ManuscriptCard = ({ <Row alignItems="center" justify="flex-start" mb={1}> <H4>Handling editor</H4> <Text ml={1} mr={3} whiteSpace="nowrap"> - {get(handlingEditor, 'name', 'Undefined')} + {get(handlingEditor, 'name', 'Unassigned')} </Text> {canViewReports && ( <Fragment> diff --git a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptHeader.js b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptHeader.js index 50a362878082144b4c54c077df067e084be99d12..3c5767ce9286601bbe55104bc28f16721903f839 100644 --- a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptHeader.js +++ b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptHeader.js @@ -188,7 +188,7 @@ export default compose( </Button> ) } - return <Text ml={1}>Assigned</Text> + return <Text ml={1}>{handlingEditor.name}</Text> }, }), setDisplayName('ManuscriptHeader'), diff --git a/packages/xpub-faraday/config/authsome-helpers.js b/packages/xpub-faraday/config/authsome-helpers.js index 08e583c721fa6103de2f4729e0f2e64a348567a7..8aa6edd8e7730aec9b71443a2585be876fa9e685 100644 --- a/packages/xpub-faraday/config/authsome-helpers.js +++ b/packages/xpub-faraday/config/authsome-helpers.js @@ -4,8 +4,6 @@ const { omit, get, last, chain } = require('lodash') const statuses = config.get('statuses') -const keysToOmit = [`email`, `id`] -const authorCannotViewHENameStatuses = ['heInvited'] const authorAllowedStatuses = ['revisionRequested', 'rejected', 'accepted'] const getTeamsByPermissions = async ( @@ -74,21 +72,26 @@ const filterAuthorRecommendations = (recommendations, status, isLast) => { const stripeCollectionByRole = ({ collection = {}, role = '' }) => { if (role === 'author') { - const { handlingEditor } = collection - - if (authorCannotViewHENameStatuses.includes(collection.status)) { + if (collection.status === 'heInvited') { + return { + ...collection, + handlingEditor: { + name: 'Assigned', + }, + } + } + if (collection.status === 'submitted') { return { ...collection, - handlingEditor: handlingEditor && - !handlingEditor.isAccepted && { - ...omit(handlingEditor, keysToOmit), - name: 'Assigned', - }, + handlingEditor: { + name: 'Unssigned', + }, } } } return collection } + const stripeFragmentByRole = ({ fragment = {}, role = '', diff --git a/packages/xpub-faraday/config/authsome-mode.js b/packages/xpub-faraday/config/authsome-mode.js index fe678f981257b9e3a67647f062f3f15ef0f87f31..c9df55d68c485557d2c6031a4a5a35e6f9f752a9 100644 --- a/packages/xpub-faraday/config/authsome-mode.js +++ b/packages/xpub-faraday/config/authsome-mode.js @@ -93,8 +93,13 @@ async function applyAuthenticatedUserPolicy(user, operation, object, context) { FragmentModel: context.models.Fragment, }) + const parsedCollection = helpers.stripeCollectionByRole({ + collection, + role, + }) + return { - ...collection, + ...parsedCollection, ...parsedStatuses, fragments: role !== 'reviewer'