diff --git a/packages/component-manuscript-manager/src/notifications/emailCopy.js b/packages/component-manuscript-manager/src/notifications/emailCopy.js index 3819d77a5c80bfc82dc49ab8bb3a94d1b2facdc9..67bfe04a10871271dec8db264da90e0b619fb7b0 100644 --- a/packages/component-manuscript-manager/src/notifications/emailCopy.js +++ b/packages/component-manuscript-manager/src/notifications/emailCopy.js @@ -150,6 +150,11 @@ const getEmailCopy = ({ 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 + case 'author-request-to-revision-from-eic': + paragraph = `In order for ${titleText} to proceed to the review process, there needs to be a revision. <br/><br/> + ${comments}<br/><br/> + For more information about what is required, please click the link below.<br/><br/>` + break default: throw new Error(`The ${emailType} email type is not defined.`) } diff --git a/packages/component-manuscript-manager/src/notifications/notification.js b/packages/component-manuscript-manager/src/notifications/notification.js index d80fb11f2c6a5b8486f9641d06b6bace4ff67cc8..c80f5c29a2efa52a545033d57ca6929d5365ccd5 100644 --- a/packages/component-manuscript-manager/src/notifications/notification.js +++ b/packages/component-manuscript-manager/src/notifications/notification.js @@ -407,6 +407,53 @@ class Notification { return email.sendEmail() } + async notifySAWhenEiCRequestsRevision() { + const { + eicName, + submittingAuthor, + titleText, + } = await this._getNotificationProperties() + + const authorNoteText = helpers.getPrivateNoteTextForAuthor({ + newRecommendation: this.newRecommendation, + }) + + const { paragraph, ...bodyProps } = getEmailCopy({ + emailType: 'author-request-to-revision-from-eic', + titleText, + comments: authorNoteText, + }) + + const email = new Email({ + type: 'user', + toUser: { + email: submittingAuthor.email, + name: submittingAuthor.lastName, + }, + fromEmail: `${eicName} <${staffEmail}>`, + content: { + subject: `${this.collection.customId}: Revision requested`, + paragraph, + signatureName: eicName, + ctaText: 'MANUSCRIPT DETAILS', + signatureJournal: journalName, + unsubscribeLink: services.createUrl(this.baseUrl, unsubscribeSlug, { + id: submittingAuthor.id, + token: submittingAuthor.accessTokens.unsubscribe, + }), + ctaLink: services.createUrl( + this.baseUrl, + `/projects/${this.collection.id}/versions/${ + this.fragment.id + }/details`, + ), + }, + bodyProps, + }) + + return email.sendEmail() + } + async notifyReviewersWhenHEMakesRecommendation() { const { eicName, diff --git a/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/strategies/eicRequestRevision.js b/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/strategies/eicRequestRevision.js index a98304d7a35dae58e81b0809022dcc823dd44781..0f66d8af7163765974379ceee97f12b887cbae5b 100644 --- a/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/strategies/eicRequestRevision.js +++ b/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/strategies/eicRequestRevision.js @@ -1,5 +1,10 @@ module.exports = { - execute: async ({ fragmentHelper, collectionHelper, newRecommendation }) => { + execute: async ({ + fragmentHelper, + collectionHelper, + newRecommendation, + notification, + }) => { if (collectionHelper.hasHandlingEditor()) { throw new Error( 'Cannot make request a revision after a Handling Editor has been assigned.', @@ -9,5 +14,6 @@ module.exports = { await fragmentHelper.addRevision() await collectionHelper.updateStatus({ newStatus: 'revisionRequested' }) await fragmentHelper.addRecommendation(newRecommendation) + await notification.notifySAWhenEiCRequestsRevision() }, }