From d5621eaacecef626bfa20a3b455bfe96cbec2c13 Mon Sep 17 00:00:00 2001
From: Tania Fecheta <tania.fecheta@thinslices.com>
Date: Tue, 27 Nov 2018 12:58:39 +0200
Subject: [PATCH] fix(manuscriptHeader): as admin/eic i should see unassigned
 inseted of he name until he is invited

---
 .../src/manuscriptDetails/ManuscriptHeader.js     |  8 +++++---
 packages/xpub-faraday/config/authsome-helpers.js  |  3 ++-
 .../tests/config/authsome-helpers.test.js         | 15 ++++++++++++++-
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptHeader.js b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptHeader.js
index 3c5767ce9..3c73c09d8 100644
--- a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptHeader.js
+++ b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptHeader.js
@@ -1,5 +1,5 @@
 import React, { Fragment } from 'react'
-import { get, chain } from 'lodash'
+import { get, chain, isEmpty } from 'lodash'
 import { H2, H4, DateParser, Button } from '@pubsweet/ui'
 import {
   compose,
@@ -170,7 +170,9 @@ export default compose(
           />
         )
       }
-
+      if (!isEmpty(pendingInvitation)) {
+        return <Text ml={1}>{handlingEditor.name}</Text>
+      }
       if (heInvitation) {
         return <Text ml={1}>{handlingEditor.name}</Text>
       }
@@ -188,7 +190,7 @@ export default compose(
           </Button>
         )
       }
-      return <Text ml={1}>{handlingEditor.name}</Text>
+      return <Text ml={1}>Unassigned</Text>
     },
   }),
   setDisplayName('ManuscriptHeader'),
diff --git a/packages/xpub-faraday/config/authsome-helpers.js b/packages/xpub-faraday/config/authsome-helpers.js
index 5fc65df32..39f753c53 100644
--- a/packages/xpub-faraday/config/authsome-helpers.js
+++ b/packages/xpub-faraday/config/authsome-helpers.js
@@ -112,11 +112,12 @@ const stripeCollectionByRole = ({ collection = {}, role = '' }) => {
       return {
         ...collection,
         handlingEditor: {
-          name: 'Unssigned',
+          name: 'Unassigned',
         },
       }
     }
   }
+
   return collection
 }
 
diff --git a/packages/xpub-faraday/tests/config/authsome-helpers.test.js b/packages/xpub-faraday/tests/config/authsome-helpers.test.js
index de16758af..41fa760af 100644
--- a/packages/xpub-faraday/tests/config/authsome-helpers.test.js
+++ b/packages/xpub-faraday/tests/config/authsome-helpers.test.js
@@ -19,7 +19,7 @@ describe('Authsome Helpers', () => {
       expect(newCollection).toBeTruthy()
     })
 
-    it('Author should not see HE name on dashboard before HE accepts invitation', () => {
+    it('Author should see Assigned instead of HE name on dashboard before HE accepts invitation', () => {
       const { collection } = testFixtures.collections
       collection.handlingEditor = {
         ...collection.handlingEditor,
@@ -86,6 +86,19 @@ describe('Authsome Helpers', () => {
       const { handlingEditor = {} } = newCollection
       expect(handlingEditor.name).not.toEqual('Assigned')
     })
+
+    it('Author should see Unassigned insted of HE name before HE is invited', () => {
+      const { collection } = testFixtures.collections
+      collection.status = 'submitted'
+      const role = 'author'
+      const newCollection = ah.stripeCollectionByRole({
+        collection,
+        role,
+      })
+      const { handlingEditor = {} } = newCollection
+      expect(handlingEditor.name).toEqual('Unassigned')
+    })
+
     it('stripeCollection - returns if collection does not have HE', () => {
       const { collection } = testFixtures.collections
       delete collection.handlingEditor
-- 
GitLab