From 24d4ce60f589bbcb3a3161969e6f81528d519ca9 Mon Sep 17 00:00:00 2001
From: Sebastian Mihalache <sebastian.mihalache@gmail.con>
Date: Wed, 12 Sep 2018 21:26:16 +0300
Subject: [PATCH] feat(emails): add from email

---
 .../component-email/src/routes/emails/notifications.js     | 6 +++---
 .../component-helper-service/src/services/email/Email.js   | 2 +-
 .../routes/fragmentsInvitations/emails/notifications.js    | 7 ++++++-
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/packages/component-email/src/routes/emails/notifications.js b/packages/component-email/src/routes/emails/notifications.js
index 98db2ecda..66f2dfa15 100644
--- a/packages/component-email/src/routes/emails/notifications.js
+++ b/packages/component-email/src/routes/emails/notifications.js
@@ -5,7 +5,7 @@ const resetPath = config.get('invite-reset-password.url')
 
 const { Email, services } = require('pubsweet-component-helper-service')
 
-const { helpers } = require('./helpers')
+const { sendNewUserEmail, sendSignupEmail } = require('./helpers')
 
 module.exports = {
   async sendNotifications({ user, baseUrl, role, UserModel }) {
@@ -33,9 +33,9 @@ module.exports = {
     })
 
     if (role) {
-      helpers.sendNewUserEmail({ email, role })
+      sendNewUserEmail({ email, role })
     } else {
-      helpers.sendSignupEmail({ email, baseUrl, user })
+      sendSignupEmail({ email, baseUrl, user })
     }
   },
 }
diff --git a/packages/component-helper-service/src/services/email/Email.js b/packages/component-helper-service/src/services/email/Email.js
index 037773fdf..d161f2129 100644
--- a/packages/component-helper-service/src/services/email/Email.js
+++ b/packages/component-helper-service/src/services/email/Email.js
@@ -4,7 +4,7 @@ const helpers = require('./helpers')
 const SendEmail = require('@pubsweet/component-send-email')
 const logger = require('@pubsweet/logger')
 
-const mainFromEmail = config.get('mailer.from')
+const mainFromEmail = config.get('journal.staffEmail')
 class Email {
   constructor({
     type = 'system',
diff --git a/packages/component-invite/src/routes/fragmentsInvitations/emails/notifications.js b/packages/component-invite/src/routes/fragmentsInvitations/emails/notifications.js
index 5ddd51df6..c15717402 100644
--- a/packages/component-invite/src/routes/fragmentsInvitations/emails/notifications.js
+++ b/packages/component-invite/src/routes/fragmentsInvitations/emails/notifications.js
@@ -2,6 +2,8 @@ const config = require('config')
 const { get } = require('lodash')
 
 const unsubscribeSlug = config.get('unsubscribe.url')
+const fromEmail = config.get('journal.staffEmail')
+const journalName = config.get('journal.name')
 
 const {
   User,
@@ -39,14 +41,16 @@ module.exports = {
     const eicName = await userHelper.getEiCName()
 
     const email = new Email({
+      fromEmail,
       type: 'user',
       content: {
+        ctaText: 'MANUSCRIPT DETAILS',
+        signatureJournal: journalName,
         signatureName: handlingEditor.name,
         ctaLink: services.createUrl(
           baseUrl,
           `/projects/${collection.id}/versions/${fragment.id}/details`,
         ),
-        ctaText: 'MANUSCRIPT DETAILS',
       },
     })
 
@@ -98,6 +102,7 @@ const sendHandlingEditorEmail = ({
     id: handlingEditor.id,
   })
   email.content.signatureName = eicName
+  email.content.signatureJournal = ''
 
   const { html, text } = email.getBody({
     body: getEmailCopy({
-- 
GitLab