diff --git a/packages/component-manuscript-manager/src/notifications/emailCopy.js b/packages/component-manuscript-manager/src/notifications/emailCopy.js index 308206da631a6ea6cb592f5c2ef2778c18837318..67bfe04a10871271dec8db264da90e0b619fb7b0 100644 --- a/packages/component-manuscript-manager/src/notifications/emailCopy.js +++ b/packages/component-manuscript-manager/src/notifications/emailCopy.js @@ -144,6 +144,12 @@ 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 'eic-revision-published': + 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 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/> diff --git a/packages/component-manuscript-manager/src/notifications/notification.js b/packages/component-manuscript-manager/src/notifications/notification.js index 6770d36f4098ed76cd1efe477ca600708d947123..c80f5c29a2efa52a545033d57ca6929d5365ccd5 100644 --- a/packages/component-manuscript-manager/src/notifications/notification.js +++ b/packages/component-manuscript-manager/src/notifications/notification.js @@ -676,6 +676,48 @@ class Notification { }) } + async notifyEditorInChiefWhenAuthorSubmitsRevision(newFragment) { + const { titleText } = await this._getNotificationProperties() + + const userHelper = new User({ UserModel: this.UserModel }) + const editors = await userHelper.getEditorsInChief() + + const { paragraph, ...bodyProps } = getEmailCopy({ + titleText, + emailType: 'eic-revision-published', + }) + + editors.forEach(eic => { + const email = new Email({ + type: 'user', + fromEmail: `${journalName} <${staffEmail}>`, + toUser: { + email: eic.email, + }, + content: { + subject: `${this.collection.customId}: Revision submitted`, + paragraph, + signatureName: '', + signatureJournal: journalName, + ctaLink: services.createUrl( + this.baseUrl, + `/projects/${this.collection.id}/versions/${ + newFragment.id + }/details`, + ), + ctaText: 'MANUSCRIPT DETAILS', + unsubscribeLink: services.createUrl(this.baseUrl, unsubscribeSlug, { + id: eic.id, + token: eic.accessTokens.unsubscribe, + }), + }, + bodyProps, + }) + + return email.sendEmail() + }) + } + async notifyReviewersWhenAuthorSubmitsMajorRevision(newFragmentId) { const { fragmentHelper } = await this._getNotificationProperties() const { collection, UserModel } = this diff --git a/packages/component-manuscript-manager/src/routes/fragments/strategies/eicRequestRevision.js b/packages/component-manuscript-manager/src/routes/fragments/strategies/eicRequestRevision.js index d62b0b83d4058b26568ac939f4eb7d0417a7d78d..eb99d655a56a86d441b9746b51aaac4af9810501 100644 --- a/packages/component-manuscript-manager/src/routes/fragments/strategies/eicRequestRevision.js +++ b/packages/component-manuscript-manager/src/routes/fragments/strategies/eicRequestRevision.js @@ -1,10 +1,11 @@ module.exports = { execute: async ({ models, - userHelper, TeamHelper, fragmentHelper, collectionHelper, + notification, + userHelper, }) => { const eicRequestToRevision = fragmentHelper.getLatestEiCRequestToRevision() if (!eicRequestToRevision) { @@ -40,6 +41,8 @@ module.exports = { await collectionHelper.addFragment(newFragment.id) + await notification.notifyEditorInChiefWhenAuthorSubmitsRevision(newFragment) + return newFragment }, }