From cc45128ef7d87d06018eed2711a89c404c1f512f Mon Sep 17 00:00:00 2001
From: Alexandru Munteanu <alexandru.munt@gmail.com>
Date: Thu, 31 May 2018 15:42:46 +0300
Subject: [PATCH] fix(eic-decision): hide invite and decision buttons when
 manuscript is rejected

---
 packages/component-faraday-selectors/src/index.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/packages/component-faraday-selectors/src/index.js b/packages/component-faraday-selectors/src/index.js
index 1d9911891..277860ce9 100644
--- a/packages/component-faraday-selectors/src/index.js
+++ b/packages/component-faraday-selectors/src/index.js
@@ -29,6 +29,9 @@ export const currentUserIs = ({ currentUser: { user } }, role) => {
 }
 
 export const canInviteReviewers = ({ currentUser: { user } }, project) => {
+  const status = get(project, 'status')
+  if (!status || status === 'rejected') return false
+
   const handlingEditor = get(project, 'handlingEditor')
   const isAdmin = get(user, 'admin')
   const isEic = get(user, 'editorInChief')
@@ -54,7 +57,10 @@ export const getHERecommendation = (state, collectionId, fragmentId) => {
 }
 
 export const canMakeDecision = (state, collection) => {
-  const isEIC = currentUserIs(state, 'adminEiC')
   const status = get(collection, 'status')
+
+  if (!status || status === 'rejected') return false
+
+  const isEIC = currentUserIs(state, 'adminEiC')
   return isEIC && status
 }
-- 
GitLab