Skip to content
Snippets Groups Projects
Commit d6a8a550 authored by Tania Fecheta's avatar Tania Fecheta
Browse files

fix(authsome-helpers): author and eic see Unassigned on dashboard when he is not invited

parent c2b236cd
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 = ({
<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>
......
......@@ -188,7 +188,7 @@ export default compose(
</Button>
)
}
return <Text ml={1}>Assigned</Text>
return <Text ml={1}>{handlingEditor.name}</Text>
},
}),
setDisplayName('ManuscriptHeader'),
......
......@@ -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 = '',
......
......@@ -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'
......
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