From de4add58651cdc4513f1207e386b7f13a6ea4f58 Mon Sep 17 00:00:00 2001
From: Sebastian Mihalache <sebastian.mihalache@gmail.con>
Date: Thu, 24 May 2018 13:54:16 +0300
Subject: [PATCH] feat(component-invite): fix email thank you

---
 packages/component-invite/src/helpers/User.js | 23 ++++++++++---------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/packages/component-invite/src/helpers/User.js b/packages/component-invite/src/helpers/User.js
index d64a9d9a9..e36c2f90c 100644
--- a/packages/component-invite/src/helpers/User.js
+++ b/packages/component-invite/src/helpers/User.js
@@ -80,17 +80,18 @@ const setupReviewerDecisionEmailData = async ({
       timestamp,
     },
   })
-  await mailService.sendNotificationEmail({
-    toEmail: user.email,
-    user,
-    emailType: 'reviewer-thank-you',
-    meta: {
-      collection: { customId: collection.customId, id: collection.id },
-      fragment: { id, title, authorName },
-      handlingEditorName: collection.handlingEditor.name,
-      baseUrl,
-    },
-  })
+  if (agree)
+    await mailService.sendNotificationEmail({
+      toEmail: user.email,
+      user,
+      emailType: 'reviewer-thank-you',
+      meta: {
+        collection: { customId: collection.customId, id: collection.id },
+        fragment: { id, title, authorName },
+        handlingEditorName: collection.handlingEditor.name,
+        baseUrl,
+      },
+    })
 }
 
 const setupReviewerUnassignEmail = async ({
-- 
GitLab