From bde101fc3acc0e66c5537ff388c1f15b8561de9f Mon Sep 17 00:00:00 2001 From: Sebastian Mihalache <sebi.mihalache@gmail.com> Date: Mon, 22 Oct 2018 11:16:36 +0300 Subject: [PATCH] feat(submit-revision): update email content, fix submitted reviewers email --- .../fragments/notifications/emailCopy.js | 6 ++++-- .../fragments/notifications/notifications.js | 18 ++++++++++-------- .../src/routes/fragments/patch.js | 3 ++- 3 files changed, 16 insertions(+), 11 deletions(-) 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 64f10e4fc..ecfadb0a4 100644 --- a/packages/component-manuscript-manager/src/routes/fragments/notifications/emailCopy.js +++ b/packages/component-manuscript-manager/src/routes/fragments/notifications/emailCopy.js @@ -5,10 +5,12 @@ const journalName = config.get('journal.name') const getEmailCopy = ({ emailType, titleText, expectedDate, customId }) => { let paragraph const hasLink = true - const hasIntro = true - const hasSignature = true + let hasIntro = true + let hasSignature = true switch (emailType) { case 'he-new-version-submitted': + hasIntro = false + hasSignature = false paragraph = `The authors of ${titleText} have submitted a revised version. <br/><br/> To review this new submission and proceed with the review process, please visit the manuscript details page.` break 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 75be73180..7f0b8fd3d 100644 --- a/packages/component-manuscript-manager/src/routes/fragments/notifications/notifications.js +++ b/packages/component-manuscript-manager/src/routes/fragments/notifications/notifications.js @@ -21,6 +21,7 @@ module.exports = { UserModel, collection, isNewVersion = false, + previousVersion, isTechnicalCheck, isMajorRecommendation, }) { @@ -59,7 +60,6 @@ module.exports = { const heUser = await UserModel.find(handlingEditor.id) sendHandlingEditorEmail({ email, - eicName, baseUrl, customId, title: parsedFragment.title, @@ -73,8 +73,9 @@ module.exports = { baseUrl, customId, UserModel, - fragmentHelper, + previousVersion, title: parsedFragment.title, + heName: collection.handlingEditor.name, }) } @@ -104,7 +105,6 @@ module.exports = { const sendHandlingEditorEmail = ({ email, title, - eicName, baseUrl, customId, handlingEditor, @@ -113,19 +113,17 @@ const sendHandlingEditorEmail = ({ email.toUser = { email: handlingEditor.email, - name: handlingEditor.name, } email.content.unsubscribeLink = services.createUrl(baseUrl, unsubscribeSlug, { id: handlingEditor.id, token: handlingEditor.accessTokens.unsubscribe, }) - email.content.signatureName = eicName email.content.subject = `${customId}: Revision submitted` const { html, text } = email.getNotificationBody({ emailBodyProps: getEmailCopy({ emailType, - titleText: `the manuscript titled ${title}`, + titleText: `the manuscript titled "${title}"`, }), }) email.sendEmail({ html, text }) @@ -134,14 +132,18 @@ const sendHandlingEditorEmail = ({ const sendReviewersEmail = async ({ email, title, + heName, baseUrl, customId, UserModel, - fragmentHelper, + previousVersion, }) => { email.content.subject = `${customId}: A manuscript you reviewed has been revised` + email.content.signatureName = heName + email.fromEmail = `${heName} <${staffEmail}>` const emailType = 'submitted-reviewers-after-revision' + const fragmentHelper = new Fragment({ fragment: previousVersion }) const reviewers = await fragmentHelper.getReviewers({ UserModel, type: 'submitted', @@ -165,7 +167,7 @@ const sendReviewersEmail = async ({ const { html, text } = email.getNotificationBody({ emailBodyProps: getEmailCopy({ emailType, - titleText: `the manuscript titled ${title}`, + titleText: `the manuscript titled "${title}"`, expectedDate: services.getExpectedDate({ daysExpected: 14 }), }), }) diff --git a/packages/component-manuscript-manager/src/routes/fragments/patch.js b/packages/component-manuscript-manager/src/routes/fragments/patch.js index e782229ac..09e3dbc8f 100644 --- a/packages/component-manuscript-manager/src/routes/fragments/patch.js +++ b/packages/component-manuscript-manager/src/routes/fragments/patch.js @@ -116,10 +116,11 @@ module.exports = models => async (req, res) => { collection.save() notifications.sendNotifications({ - fragment: newFragment, collection, isNewVersion: true, + fragment: newFragment, UserModel: models.User, + previousVersion: fragment, baseUrl: services.getBaseUrl(req), isMajorRecommendation: heRecommendation.recommendation === 'major', }) -- GitLab