From 23e10d9f45c3346b16f3cc7c5789655dec5c38d5 Mon Sep 17 00:00:00 2001 From: Anca Ursachi <anca.ursachi@thinslices.com> Date: Mon, 22 Oct 2018 17:57:55 +0300 Subject: [PATCH] fix(editorialReportCard): After HE accept the invitation author can see his name in all statuses aft --- .../src/EditorialReportCard.js | 14 ++-------- .../src/contextualBoxes/AuthorReviews.js | 2 +- .../xpub-faraday/config/authsome-helpers.js | 26 +------------------ packages/xpub-faraday/config/authsome-mode.js | 7 +---- 4 files changed, 5 insertions(+), 44 deletions(-) diff --git a/packages/component-faraday-ui/src/EditorialReportCard.js b/packages/component-faraday-ui/src/EditorialReportCard.js index 9f326c340..a43986b4f 100644 --- a/packages/component-faraday-ui/src/EditorialReportCard.js +++ b/packages/component-faraday-ui/src/EditorialReportCard.js @@ -17,7 +17,6 @@ const EditorialReportCard = ({ recommendation, editorName, editorRole, - handlingEditorName, collection, report: { createdOn, reviewer }, }) => ( @@ -36,7 +35,7 @@ const EditorialReportCard = ({ {reviewer && ( <Fragment> <Text mr={1 / 2}> - {handlingEditorName !== 'Assigned' ? editorName : ''} + {editorName !== 'Assigned' ? editorName : ''} </Text> <Tag mr={2}>{editorRole}</Tag> </Fragment> @@ -81,8 +80,6 @@ export default compose( 'reviewer.lastName', '', )}`, - getHandlingEditorName: ({ collection }) => () => - `${get(collection, 'handlingEditor.name', '')}`, getRecommendationLabel: ({ report, journal: { recommendations = [] }, @@ -94,17 +91,10 @@ export default compose( ), }), withProps( - ({ - report, - getReviewerRole, - getReviewerName, - getHandlingEditorName, - getRecommendationLabel, - }) => ({ + ({ report, getReviewerRole, getReviewerName, getRecommendationLabel }) => ({ recommendation: getRecommendationLabel(), publicReport: getReportComments({ report, isPublic: true }), privateReport: getReportComments({ report, isPublic: false }), - handlingEditorName: getHandlingEditorName(), editorName: getReviewerName(), editorRole: getReviewerRole(), }), diff --git a/packages/component-faraday-ui/src/contextualBoxes/AuthorReviews.js b/packages/component-faraday-ui/src/contextualBoxes/AuthorReviews.js index 447a7614b..1bd5ca285 100644 --- a/packages/component-faraday-ui/src/contextualBoxes/AuthorReviews.js +++ b/packages/component-faraday-ui/src/contextualBoxes/AuthorReviews.js @@ -16,7 +16,7 @@ const SubmittedReportsNumberForAuthorReviews = ({ reports }) => ( ) const AuthorReviews = ({ invitations, journal, reports, fragment }) => - reports.length && ( + reports.length > 0 && ( <ContextualBox label="Review Reports" rightChildren={ diff --git a/packages/xpub-faraday/config/authsome-helpers.js b/packages/xpub-faraday/config/authsome-helpers.js index 0d9909612..c65fa8ca6 100644 --- a/packages/xpub-faraday/config/authsome-helpers.js +++ b/packages/xpub-faraday/config/authsome-helpers.js @@ -138,24 +138,6 @@ const filterAuthorRecommendations = (recommendations, status, isLast) => { return [] } -const stripeCollectionByRole = ({ collection = {}, role = '' }) => { - if (role === 'author') { - const { handlingEditor } = collection - - if (!authorCanViewHENameStatuses.includes(collection.status)) { - return { - ...collection, - handlingEditor: handlingEditor && - handlingEditor.isAccepted && { - ...omit(handlingEditor, keysToOmit), - name: 'Assigned', - }, - } - } - } - return collection -} - const stripeFragmentByRole = ({ fragment = {}, role = '', @@ -246,11 +228,6 @@ const getCollections = async ({ user, models }) => { const status = get(collection, 'status', 'draft') collection.visibleStatus = get(statuses, `${status}.${up.role}.label`) - const stripedColl = stripeCollectionByRole({ - collection, - role: up.role, - }) - const role = get(up, 'role', 'author') let visibleStatus = get(statuses, `${status}.${role}.label`) @@ -263,7 +240,7 @@ const getCollections = async ({ user, models }) => { }) } - return { ...stripedColl, visibleStatus } + return { ...collection, visibleStatus } }), )).filter(Boolean) } @@ -307,7 +284,6 @@ module.exports = { hasPermissionForObject, isInDraft, hasFragmentInDraft, - stripeCollectionByRole, stripeFragmentByRole, getUsersList, parseUser, diff --git a/packages/xpub-faraday/config/authsome-mode.js b/packages/xpub-faraday/config/authsome-mode.js index e480663e8..7b269f385 100644 --- a/packages/xpub-faraday/config/authsome-mode.js +++ b/packages/xpub-faraday/config/authsome-mode.js @@ -96,13 +96,8 @@ async function applyAuthenticatedUserPolicy(user, operation, object, context) { ) } - const parsedCollection = helpers.stripeCollectionByRole({ - collection, - role, - }) - return { - ...parsedCollection, + ...collection, visibleStatus, } }, -- GitLab