From 114b0c88529b3abe21ddca2d6714d3e4c2f5b327 Mon Sep 17 00:00:00 2001
From: Sebastian Mihalache <sebi.mihalache@gmail.com>
Date: Mon, 8 Oct 2018 15:13:36 +0300
Subject: [PATCH] feat(manuscript-manager): update email copy for HE reject

---
 .../notifications/emailCopy.js                |  4 ++--
 .../notifications/notifications.js            | 19 ++++++++++++-------
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/emailCopy.js b/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/emailCopy.js
index fbb64a10e..8fadac625 100644
--- a/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/emailCopy.js
+++ b/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/emailCopy.js
@@ -87,8 +87,8 @@ const getEmailCopy = ({
     case 'eic-recommend-to-reject-from-he':
       hasIntro = false
       hasSignature = false
-      paragraph = `Dr. ${targetUserName} has recommended rejecting ${titleText}.<br/>
-        ${comments}<br/>
+      paragraph = `Dr. ${targetUserName} has recommended rejecting ${titleText}.<br/><br/>
+        ${comments}<br/><br/>
         To review this decision, please visit the manuscript details page.`
       break
     case 'eic-request-revision-from-he':
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 c24b1e0f6..eee5ba2fc 100644
--- a/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/notifications.js
+++ b/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/notifications.js
@@ -29,12 +29,15 @@ module.exports = {
     const parsedFragment = await fragmentHelper.getFragmentData({
       handlingEditor: collection.handlingEditor,
     })
-    const fragmentAuthors = await fragmentHelper.getAuthorData({ UserModel })
+    const {
+      activeAuthors,
+      submittingAuthor,
+    } = await fragmentHelper.getAuthorData({ UserModel })
 
     const subjectBaseText = `${collection.customId}: Manuscript`
     const titleText = `The manuscript titled "${parsedFragment.title}" by ${
-      fragmentAuthors.submittingAuthor.firstName
-    } ${fragmentAuthors.submittingAuthor.lastName}`
+      submittingAuthor.firstName
+    } ${submittingAuthor.lastName}`
 
     const userHelper = new User({ UserModel })
     const eicName = await userHelper.getEiCName()
@@ -135,7 +138,7 @@ module.exports = {
         comments,
         emailType,
         title: parsedFragment.title,
-        fragmentAuthors: fragmentAuthors.activeAuthors,
+        fragmentAuthors: activeAuthors,
       })
       email = helpers.updateEmailContentForAllAuthors({
         email,
@@ -151,10 +154,10 @@ module.exports = {
         newRecommendation,
       })
       const author = helpers.getSubmittingAuthor({
-        authorNoteText,
         journalName,
+        authorNoteText,
+        submittingAuthor,
         title: parsedFragment.title,
-        submittingAuthor: fragmentAuthors.submittingAuthor,
       })
       email = helpers.updateEmailContentForSA({
         email,
@@ -203,10 +206,12 @@ module.exports = {
         email,
         baseUrl,
         customId,
-        titleText,
         userHelper,
         recommendation: newRecommendation,
         targetUserName: collHelper.getHELastName(),
+        titleText: `the submission "${parsedFragment.title}" by ${
+          submittingAuthor.firstName
+        } ${submittingAuthor.lastName}`,
       })
     }
 
-- 
GitLab