diff --git a/packages/component-manuscript-manager/src/routes/fragments/notifications/emailCopy.js b/packages/component-manuscript-manager/src/routes/fragments/notifications/emailCopy.js index 2c7c5302b5f0eb5f18392031eed2120b93156810..6b7c64bcf95b2803bea159ba981f35817f150ea0 100644 --- a/packages/component-manuscript-manager/src/routes/fragments/notifications/emailCopy.js +++ b/packages/component-manuscript-manager/src/routes/fragments/notifications/emailCopy.js @@ -1,4 +1,4 @@ -const getEmailCopy = ({ emailType, titleText, expectedDate }) => { +const getEmailCopy = ({ emailType, titleText, expectedDate, customId }) => { let paragraph switch (emailType) { case 'he-new-version-submitted': @@ -11,7 +11,9 @@ const getEmailCopy = ({ emailType, titleText, expectedDate }) => { case 'eic-manuscript-submitted': paragraph = `A new manuscript has been submitted. You can view ${titleText} and take further actions by clicking on the following link:` break - + case 'eqs-manuscript-submitted': + paragraph = `Manuscript ID ${customId} has been submitted and a package has been sent. Please click on the link below to either approve or reject the manuscript:` + break default: throw new Error(`The ${emailType} email type is not defined.`) } diff --git a/packages/component-manuscript-manager/src/routes/fragments/notifications/notifications.js b/packages/component-manuscript-manager/src/routes/fragments/notifications/notifications.js index b6fa7b690fad758f767c8502a8d258a1ef4ac74b..2d362b84035b7ff979560c3c9fd1ecd885fd4d49 100644 --- a/packages/component-manuscript-manager/src/routes/fragments/notifications/notifications.js +++ b/packages/component-manuscript-manager/src/routes/fragments/notifications/notifications.js @@ -11,6 +11,7 @@ const { const { getEmailCopy } = require('./emailCopy') const unsubscribeSlug = config.get('unsubscribe.url') +const editorialAssistantEmail = config.get('mailer.editorialAssistant') module.exports = { async sendNotifications({ @@ -19,7 +20,7 @@ module.exports = { UserModel, collection, isNewVersion = false, - isForEditorInChief, + isTechnicalCheck, isMajorRecommendation, }) { const fragmentHelper = new Fragment({ fragment }) @@ -72,13 +73,12 @@ module.exports = { }) } - if (isForEditorInChief) { - sendEiCEmail({ + if (isTechnicalCheck) { + sendEQSEmail({ eic, email, baseUrl, - titleText, - fragmentHelper, + collection, subjectBaseText, }) } @@ -156,24 +156,24 @@ const sendReviewersEmail = async ({ }) } -const sendEiCEmail = ({ eic, email, baseUrl, titleText, subjectBaseText }) => { - const emailType = 'eic-manuscript-submitted' +const sendEQSEmail = ({ eic, email, baseUrl, collection, subjectBaseText }) => { + const emailType = 'eqs-manuscript-submitted' email.toUser = { - email: eic.email, - name: `${eic.firstName} ${eic.lastName}`, + email: editorialAssistantEmail, + name: 'Editorial Assistant', } - email.content.unsubscribeLink = services.createUrl(baseUrl, unsubscribeSlug, { - id: eic.id, - }) - email.content.signatureName = 'Hindawi Submission System' + email.content.unsubscribeLink = baseUrl + email.content.signatureName = `${eic.firstName} ${eic.lastName}` email.content.subject = `${subjectBaseText} Submitted` + email.content.ctaLink = '' + email.content.ctaText = 'MAKE DECISION' const { html, text } = email.getBody({ body: getEmailCopy({ emailType, - titleText, + customId: collection.customId, }), }) email.sendEmail({ html, text }) diff --git a/packages/component-manuscript-manager/src/routes/fragments/post.js b/packages/component-manuscript-manager/src/routes/fragments/post.js index 08370831a43777b576d5de876449daf401f8c69d..82a681eef028e1cebdcdedf3a2ecf7141dc0ab72 100644 --- a/packages/component-manuscript-manager/src/routes/fragments/post.js +++ b/packages/component-manuscript-manager/src/routes/fragments/post.js @@ -37,14 +37,6 @@ module.exports = models => async (req, res) => { fragment.submitted = Date.now() fragment = await fragment.save() - notifications.sendNotifications({ - fragment, - collection, - UserModel: models.User, - isForEditorInChief: true, - baseUrl: services.getBaseUrl(req), - }) - collection.status = 'technicalChecks' collection.save() @@ -60,6 +52,14 @@ module.exports = models => async (req, res) => { await MTS.sendPackage(packageFragment) + notifications.sendNotifications({ + fragment, + collection, + UserModel: models.User, + isTechnicalCheck: true, + baseUrl: services.getBaseUrl(req), + }) + return res.status(200).json(fragment) } catch (e) { const notFoundError = await services.handleNotFoundError(e, 'Item') diff --git a/packages/xpub-faraday/config/default.js b/packages/xpub-faraday/config/default.js index d7958d81f5985b02d32c1b026e20856fcb543f1d..945cc96a6ae9655316723d09687998939bbacee9 100644 --- a/packages/xpub-faraday/config/default.js +++ b/packages/xpub-faraday/config/default.js @@ -109,6 +109,7 @@ module.exports = { mailer: { from: 'faraday@hindawi.com', path: `${__dirname}/mailer`, + editorialAssistant: 'hindawi@thinslices.com', }, publicKeys: [ 'pubsweet-client',