From 2947fecbb3ac0292ee2115b5c3b3276a932c40c9 Mon Sep 17 00:00:00 2001
From: Bogdan Cochior <bogdan.cochior@thinslices.com>
Date: Thu, 16 Aug 2018 11:16:12 +0300
Subject: [PATCH] fix(emails): fix authors email sending twice

---
 .../notifications/notifications.js            | 60 +++++++------------
 1 file changed, 21 insertions(+), 39 deletions(-)

diff --git a/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/notifications.js b/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/notifications.js
index 71f25cbf6..c86bbd35a 100644
--- a/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/notifications.js
+++ b/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/notifications.js
@@ -116,45 +116,27 @@ module.exports = {
           })
         }
 
-        if (
-          newRecommendation.recommendationType !== 'review' &&
-          newRecommendation.recommendation !== 'return-to-handling-editor'
-        ) {
-          if (isEditorInChief || collection.status === 'revisionRequested') {
-            sendAuthorsEmail({
-              email,
-              baseUrl,
-              titleText,
-              parsedFragment,
-              fragmentAuthors,
-              isEditorInChief,
-              subjectBaseText,
-              newRecommendation,
-            })
-          }
-
-          if (hasPeerReview(collection)) {
-            sendReviewersEmail({
-              email,
-              baseUrl,
-              UserModel,
-              titleText,
-              fragmentHelper,
-              isEditorInChief,
-              subjectBaseText,
-              recommendation: newRecommendation.recommendation,
-              handlingEditorName: get(collection, 'handlingEditor.name', 'N/A'),
-            })
-
-            sendEiCsEmail({
-              email,
-              baseUrl,
-              userHelper,
-              titleText,
-              subjectBaseText,
-              recommendation: newRecommendation,
-            })
-          }
+        if (hasPeerReview(collection)) {
+          sendReviewersEmail({
+            email,
+            baseUrl,
+            UserModel,
+            titleText,
+            fragmentHelper,
+            isEditorInChief,
+            subjectBaseText,
+            recommendation: newRecommendation.recommendation,
+            handlingEditorName: get(collection, 'handlingEditor.name', eicName),
+          })
+
+          sendEiCsEmail({
+            email,
+            baseUrl,
+            userHelper,
+            titleText,
+            subjectBaseText,
+            recommendation: newRecommendation,
+          })
         }
       }
     }
-- 
GitLab