diff --git a/packages/component-faraday-selectors/src/index.js b/packages/component-faraday-selectors/src/index.js index adffec4aefe2ad44100423497bc6a8acc6fd21fa..5ccb0a1561c91b4ee5cd4823e4f0c6c1ac9ef340 100644 --- a/packages/component-faraday-selectors/src/index.js +++ b/packages/component-faraday-selectors/src/index.js @@ -30,7 +30,7 @@ export const currentUserIs = ({ currentUser: { user } }, role) => { export const canInviteReviewers = ({ currentUser: { user } }, project) => { const status = get(project, 'status') - if (!status || status === 'rejected') return false + if (!status || status === 'rejected' || status === 'published') return false const handlingEditor = get(project, 'handlingEditor') const isAdmin = get(user, 'admin') diff --git a/packages/component-manuscript/src/components/EditorialComment.js b/packages/component-manuscript/src/components/EditorialComment.js index b595b7907f774441dc24d5be38037638697d0d0e..c5e8838193406e423d40a283ba0ceddfb7b0009b 100644 --- a/packages/component-manuscript/src/components/EditorialComment.js +++ b/packages/component-manuscript/src/components/EditorialComment.js @@ -26,14 +26,14 @@ const EditorialComment = ({ reason, comments, updatedOn, - handlingEditor: { name }, + author: { name, role }, }) => ( <Root> <Row> <HeaderContainer> <ReasonText>{reason}</ReasonText> <CommentAuthor>{name}</CommentAuthor> - <RoleBadge>he</RoleBadge> + <RoleBadge>{role}</RoleBadge> </HeaderContainer> <DateParser timestamp={updatedOn}> {t => <DefaultText>{t}</DefaultText>} @@ -50,10 +50,22 @@ const EditorialComment = ({ export default compose( setDisplayName('EditorialComment'), - withProps(({ recommendation, comments = [] }) => ({ - reason: parseRecommendationType(recommendation), - comments: parseRecommendationComments(comments), - })), + withProps( + ({ + userId, + editorInChief, + recommendation, + handlingEditor: { id: heId, name: heName }, + comments = [], + }) => ({ + reason: parseRecommendationType(recommendation), + comments: parseRecommendationComments(comments), + author: { + name: userId === heId ? heName : editorInChief, + role: userId === heId ? 'HE' : 'EiC', + }, + }), + ), )(EditorialComment) // #region styled-components @@ -84,7 +96,6 @@ const RoleBadge = styled.span` margin-left: ${th('subGridUnit')}; padding: calc(${th('subGridUnit')} / 3); text-align: center; - text-transform: uppercase; ` const HeaderContainer = styled.div` diff --git a/packages/component-manuscript/src/components/EditorialComments.js b/packages/component-manuscript/src/components/EditorialComments.js index 591c9f31a4da8bb1989d768ada8c660844e6d027..d362434c9bbf4491535f75fa64d01626154a5170 100644 --- a/packages/component-manuscript/src/components/EditorialComments.js +++ b/packages/component-manuscript/src/components/EditorialComments.js @@ -7,11 +7,20 @@ import { setDisplayName, withProps, compose } from 'recompose' import { Expandable } from '../molecules' import { EditorialComment } from './' -const EditorialComments = ({ recommendations, handlingEditor }) => ( +const EditorialComments = ({ + recommendations, + handlingEditor, + editorInChief, +}) => ( <Root> <Expandable label="Editorial comments" startExpanded> {recommendations.map(r => ( - <EditorialComment key={r.id} {...r} handlingEditor={handlingEditor} /> + <EditorialComment + key={r.id} + {...r} + editorInChief={editorInChief} + handlingEditor={handlingEditor} + /> ))} </Expandable> </Root> diff --git a/packages/component-manuscript/src/components/ManuscriptLayout.js b/packages/component-manuscript/src/components/ManuscriptLayout.js index 556a1f4a50451995093ff33c3b6958f1235978d6..80537acec66029ed015758b1f13d2ec575a1faf7 100644 --- a/packages/component-manuscript/src/components/ManuscriptLayout.js +++ b/packages/component-manuscript/src/components/ManuscriptLayout.js @@ -59,6 +59,7 @@ const ManuscriptLayout = ({ editorialRecommendations.length > 0 && ( <EditorialComments project={project} + editorInChief={editorInChief} recommendations={editorialRecommendations} /> )} diff --git a/packages/component-manuscript/src/components/SideBarActions.js b/packages/component-manuscript/src/components/SideBarActions.js index 5d4befd132fce1bdd798db8e03082773836bca66..01f60511fa7ccfb30a467976c768c876c80e4fe2 100644 --- a/packages/component-manuscript/src/components/SideBarActions.js +++ b/packages/component-manuscript/src/components/SideBarActions.js @@ -58,7 +58,7 @@ export default compose( const Root = styled.div` border-bottom: ${th('borderDefault')}; display: flex; - justify-content: space-between; + justify-content: flex-end; padding: ${th('subGridUnit')}; ` diff --git a/packages/components-faraday/src/components/MakeDecision/utils.js b/packages/components-faraday/src/components/MakeDecision/utils.js index 1ca6f60c95255df906ddafea621fd5895bce0f17..398b188fac3713c5a628b5ae667c2ea048ffac3e 100644 --- a/packages/components-faraday/src/components/MakeDecision/utils.js +++ b/packages/components-faraday/src/components/MakeDecision/utils.js @@ -24,7 +24,7 @@ export const parseFormValues = ({ decision, messageToHE }) => { recommendation: decision, recommendationType: 'editorRecommendation', } - return messageToHE + return decision === 'return-to-handling-editor' ? { ...recommendation, comments: [ diff --git a/packages/components-faraday/src/redux/recommendations.js b/packages/components-faraday/src/redux/recommendations.js index 3decec77f2040fad93a44139f26a10368c0ebacc..a85e13f8c34818166263789e08c10df7d76ff3be 100644 --- a/packages/components-faraday/src/redux/recommendations.js +++ b/packages/components-faraday/src/redux/recommendations.js @@ -45,7 +45,7 @@ export const selectRecommendations = state => get(state, 'recommendations.recommendations') || [] export const selectEditorialRecommendations = state => selectRecommendations(state).filter( - r => r.recommendationType === 'editorRecommendation', + r => r.recommendationType === 'editorRecommendation' && r.comments, ) // #endregion