diff --git a/packages/component-manuscript-manager/src/notifications/emailCopy.js b/packages/component-manuscript-manager/src/notifications/emailCopy.js index f55b47978c32006a35b8d7a97a4a131ef51c8cb3..308206da631a6ea6cb592f5c2ef2778c18837318 100644 --- a/packages/component-manuscript-manager/src/notifications/emailCopy.js +++ b/packages/component-manuscript-manager/src/notifications/emailCopy.js @@ -144,6 +144,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 ff6c733a1eef5c52aab267747b5c384535fda11c..6770d36f4098ed76cd1efe477ca600708d947123 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() }, }