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 56d672c3325fe9dee1ae5892a19a04ca8c6b37a6..d4046f5a95f38e0c56bca849133118d98ccbd421 100644 --- a/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/emailCopy.js +++ b/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/emailCopy.js @@ -8,8 +8,8 @@ const getEmailCopy = ({ let hasLink = true switch (emailType) { case 'author-request-to-revision': - paragraph = `In order for ${titleText} to proceed to publication, there needs to be a revision. <br/><br/> - ${comments}<br/><br/> + paragraph = `In order for ${titleText} to proceed to publication, there needs to be a revision. <br/> + ${comments}<br/> For more information about what is required, please visit the manuscript details page.` break case 'author-manuscript-rejected': @@ -41,8 +41,8 @@ const getEmailCopy = ({ case 'accepted-reviewers-after-recommendation': hasLink = false paragraph = `I appreciate any time you may have spent reviewing ${titleText}. However, an editorial decision has been made and the review of this manuscript is now complete. I apologize for any inconvenience. <br/> - If you have comments on this manuscript you believe the Editor should see, please email them to Hindawi as soon as possible. <br/> - Thank you for your interest and I hope you will consider reviewing for Hindawi again.` + If you have comments on this manuscript you believe the Editor should see, please email them to Hindawi as soon as possible. <br/> + Thank you for your interest and I hope you will consider reviewing for Hindawi again.` break case 'pending-reviewers-after-recommendation': hasLink = false @@ -60,7 +60,22 @@ const getEmailCopy = ({ If you have any queries about this decision, then please email them to Hindawi as soon as possible.` break case 'he-review-submitted': - paragraph = `We are pleased to inform you that Dr. ${targetUserName} has submitted a review for ${titleText}.` + paragraph = `We are pleased to inform you that Dr. ${targetUserName} has submitted a review for ${titleText}.<br/> + Please visit the manuscript details page to see the full review.` + break + case 'eic-recommend-to-publish-from-he': + paragraph = `It is my recommendation, based on the reviews I have received for ${titleText} that we should proceed to publication.<br/> + ${comments}<br/> + For more information, and to see the full review, please visit the manuscript details page.` + break + case 'eic-recommend-to-reject-from-he': + paragraph = `It is my recommendation, based on the reviews I have received for ${titleText} that we should reject it for publication.<br/> + ${comments}<br/> + For more information, and to see the full review, please visit the manuscript details page.` + break + case 'eic-request-revision-from-he': + paragraph = `In order for ${titleText} to proceed to publication, there needs to be a revision. <br/><br/> + For more information about what is required, please visit the manuscript details page.` break default: throw new Error(`The ${emailType} email type is not defined.`) 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 ac1e57c293f884bd7c443d789439d8bf4fe8bb9b..ef6033c77ff3828f90d71c843fddf047d3f1aa58 100644 --- a/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/notifications.js +++ b/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/notifications/notifications.js @@ -36,17 +36,22 @@ module.exports = { const email = new Email({ type: 'user', content: { - signatureName: get(collection, 'handlingEditor.name', 'Hindawi'), + unsubscribeLink: baseUrl, + ctaText: 'MANUSCRIPT DETAILS', + signatureName: get(collection, 'handlingEditor.name', 'N/A'), ctaLink: services.createUrl( baseUrl, `/projects/${collection.id}/versions/${fragment.id}/details`, ), - ctaText: 'MANUSCRIPT DETAILS', }, }) const userHelper = new User({ UserModel }) - const { firstName, lastName } = await userHelper.getEditorInChief() + const { + email: eicEmail, + firstName, + lastName, + } = await userHelper.getEditorInChief() const eicName = `${firstName} ${lastName}` let comments @@ -61,6 +66,7 @@ module.exports = { } if (isEditorInChief || newRecommendation.recommendationType === 'review') { + // the request came from either the Editor in Chief or a reviewer, so the HE needs to be notified sendHandlingEditorEmail({ email, eicName, @@ -99,7 +105,17 @@ module.exports = { isEditorInChief, subjectBaseText, recommendation: newRecommendation.recommendation, - handlingEditorName: get(collection, 'handlingEditor.name', 'Faraday'), + handlingEditorName: get(collection, 'handlingEditor.name', 'N/A'), + }) + + sendEiCEmail({ + email, + baseUrl, + eicName, + eicEmail, + titleText, + subjectBaseText, + recommendation: newRecommendation, }) } }, @@ -319,6 +335,50 @@ const sendReviewersEmail = async ({ }) } +const sendEiCEmail = ({ + email, + eicName, + eicEmail, + titleText, + recommendation, + subjectBaseText, +}) => { + let emailType + + email.content.subject = `${subjectBaseText} Recommendation` + switch (recommendation.recommendation) { + case 'minor': + case 'major': + emailType = 'eic-request-revision-from-he' + break + case 'publish': + emailType = 'eic-recommend-to-publish-from-he' + break + case 'reject': + emailType = 'eic-recommend-to-reject-from-he' + break + default: + throw new Error(`undefined recommendation: ${recommendation} `) + } + + email.toUser = { + email: eicEmail, + name: eicName, + } + + const privateNote = recommendation.comments.find(comm => comm.private) + const content = get(privateNote, 'content') + const comments = content ? `Note to Editor: "${content}"` : '' + const { html, text } = email.getBody({ + body: getEmailCopy({ + emailType, + titleText, + comments, + }), + }) + email.sendEmail({ html, text }) +} + const getSubjectByRecommendation = recommendation => ['minor', 'major'].includes(recommendation) ? 'Revision Requested'