From 9bce0cc9c221b6fa6a5e08eb6f95133b6029b9bc Mon Sep 17 00:00:00 2001
From: Anca Ursachi <anca.ursachi@thinslices.com>
Date: Tue, 23 Oct 2018 09:22:52 +0300
Subject: [PATCH] fix(editorialReportCard): changes after code review

---
 .../src/EditorialReportCard.js                | 22 ++++++++++++++-----
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/packages/component-faraday-ui/src/EditorialReportCard.js b/packages/component-faraday-ui/src/EditorialReportCard.js
index a43986b4f..1f394ee94 100644
--- a/packages/component-faraday-ui/src/EditorialReportCard.js
+++ b/packages/component-faraday-ui/src/EditorialReportCard.js
@@ -17,6 +17,7 @@ const EditorialReportCard = ({
   recommendation,
   editorName,
   editorRole,
+  handlingEditorName,
   collection,
   report: { createdOn, reviewer },
 }) => (
@@ -35,7 +36,7 @@ const EditorialReportCard = ({
         {reviewer && (
           <Fragment>
             <Text mr={1 / 2}>
-              {editorName !== 'Assigned' ? editorName : ''}
+              {handlingEditorName !== 'Assigned' ? editorName : ''}
             </Text>
             <Tag mr={2}>{editorRole}</Tag>
           </Fragment>
@@ -68,18 +69,20 @@ const EditorialReportCard = ({
 
 export default compose(
   withHandlers({
-    getReviewerRole: ({ report }) => () => {
+    getEditorRole: ({ report }) => () => {
       if (get(report, 'reviewer.handlingEditor')) {
         return 'HE'
       }
       return get(report, 'reviewer.editorInChief') ? 'EiC' : ''
     },
-    getReviewerName: ({ report }) => () =>
+    getEditorName: ({ report }) => () =>
       `${get(report, 'reviewer.firstName', '')} ${get(
         report,
         'reviewer.lastName',
         '',
       )}`,
+    getHandlingEditorName: ({ collection }) => () =>
+      `${get(collection, 'handlingEditor.name', '')}`,
     getRecommendationLabel: ({
       report,
       journal: { recommendations = [] },
@@ -91,12 +94,19 @@ export default compose(
       ),
   }),
   withProps(
-    ({ report, getReviewerRole, getReviewerName, getRecommendationLabel }) => ({
+    ({
+      report,
+      getEditorRole,
+      getEditorName,
+      getHandlingEditorName,
+      getRecommendationLabel,
+    }) => ({
       recommendation: getRecommendationLabel(),
       publicReport: getReportComments({ report, isPublic: true }),
       privateReport: getReportComments({ report, isPublic: false }),
-      editorName: getReviewerName(),
-      editorRole: getReviewerRole(),
+      handlingEditorName: getHandlingEditorName(),
+      editorName: getEditorName(),
+      editorRole: getEditorRole(),
     }),
   ),
 )(EditorialReportCard)
-- 
GitLab