Skip to content
Snippets Groups Projects
Commit 6e977372 authored by Mihail Hagiu's avatar Mihail Hagiu
Browse files

feat(EiCEmail): Created email template for eic when author submits revision

parent 29dc927d
No related branches found
No related tags found
4 merge requests!196S25 - EiC submit revision,!189S25,!181Hin 1125 author email to eic,!177Hin 230 eic request revision
...@@ -144,6 +144,12 @@ const getEmailCopy = ({ ...@@ -144,6 +144,12 @@ const getEmailCopy = ({
paragraph = `The authors of ${titleText} have submitted a revised version. <br/><br/> 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.` To review this new submission and proceed with the review process, please visit the manuscript details page.`
break 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
default: default:
throw new Error(`The ${emailType} email type is not defined.`) throw new Error(`The ${emailType} email type is not defined.`)
} }
......
...@@ -629,6 +629,48 @@ class Notification { ...@@ -629,6 +629,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) { async notifyReviewersWhenAuthorSubmitsMajorRevision(newFragmentId) {
const { fragmentHelper } = await this._getNotificationProperties() const { fragmentHelper } = await this._getNotificationProperties()
const { collection, UserModel } = this const { collection, UserModel } = this
......
const { union } = require('lodash') const { union } = require('lodash')
module.exports = { module.exports = {
execute: async ({ models, TeamHelper, fragmentHelper, collectionHelper }) => { execute: async ({
models,
TeamHelper,
fragmentHelper,
collectionHelper,
notification,
}) => {
const eicRequestToRevision = fragmentHelper.getLatestEiCRequestToRevision() const eicRequestToRevision = fragmentHelper.getLatestEiCRequestToRevision()
if (!eicRequestToRevision) { if (!eicRequestToRevision) {
throw new Error('No Editor in Chief request to revision has been found.') throw new Error('No Editor in Chief request to revision has been found.')
...@@ -46,6 +52,8 @@ module.exports = { ...@@ -46,6 +52,8 @@ module.exports = {
await collectionHelper.addFragment(newFragment.id) await collectionHelper.addFragment(newFragment.id)
await notification.notifyEditorInChiefWhenAuthorSubmitsRevision(newFragment)
return newFragment return newFragment
}, },
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment