From 5cb3913c56ba5b94c73b7b48c4f3f4298af5a62f Mon Sep 17 00:00:00 2001
From: Anca Ursachi <anca.ursachi@thinslices.com>
Date: Thu, 15 Nov 2018 18:38:31 +0200
Subject: [PATCH] =?UTF-8?q?fix(manuscriptPage):=20HE=20in=20the=20status?=
 =?UTF-8?q?=20HeInvited=20shouldn=E2=80=99t=20see=20publish=20option?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 packages/component-faraday-selectors/src/index.js      | 10 ++++++++--
 .../src/components/ManuscriptPage.js                   |  5 ++++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/packages/component-faraday-selectors/src/index.js b/packages/component-faraday-selectors/src/index.js
index bf878bdbe..d7628c87e 100644
--- a/packages/component-faraday-selectors/src/index.js
+++ b/packages/component-faraday-selectors/src/index.js
@@ -238,8 +238,14 @@ const collectionReviewerReports = state =>
     .find(r => r.recommendationType === 'review' && r.submittedOn)
     .value()
 
-export const canHEMakeRecommendationToPublish = state =>
-  !!collectionReviewerReports(state)
+const cannotHEMakeRecommendationToPublish = ['heInvited']
+export const canHEMakeRecommendationToPublish = (state, collection = {}) => {
+  const status = get(collection, 'status', 'draft')
+  return (
+    !!collectionReviewerReports(state) ||
+    cannotHEMakeRecommendationToPublish.includes(status)
+  )
+}
 
 const canHEOnlyRejectStatuses = [
   'reviewersInvited',
diff --git a/packages/component-manuscript/src/components/ManuscriptPage.js b/packages/component-manuscript/src/components/ManuscriptPage.js
index 09455dd30..89b5dadef 100644
--- a/packages/component-manuscript/src/components/ManuscriptPage.js
+++ b/packages/component-manuscript/src/components/ManuscriptPage.js
@@ -208,7 +208,10 @@ export default compose(
           ),
         },
       },
-      canHEMakeRecommendationToPublish: canHEMakeRecommendationToPublish(state),
+      canHEMakeRecommendationToPublish: canHEMakeRecommendationToPublish(
+        state,
+        collection,
+      ),
       canHEOnlyReject: canHEOnlyReject(collection),
       isFetchingData: {
         editorsFetching: selectFetching(state),
-- 
GitLab