diff --git a/packages/component-mail-service/src/Mail.js b/packages/component-mail-service/src/Mail.js index 3289fe934e43e5ee282c5b778e8a3ca2dea4e3b6..c0886c2c27eb3b21b408b5d88dd36c9aa89204e1 100644 --- a/packages/component-mail-service/src/Mail.js +++ b/packages/component-mail-service/src/Mail.js @@ -468,6 +468,24 @@ module.exports = { replacements.signatureName }` break + case 'author-manuscript-published': + subject = `${meta.collection.customId}: Manuscript Decision` + replacements.previewText = 'a manuscript has been published' + replacements.intro = `Dear Dr. ${meta.fragment.authorName}` + replacements.paragraph = `I am delighted to inform you that manuscript titled "${ + meta.fragment.title + }" by ${ + meta.fragment.submittingAuthorName + } has passed through the review process and will be published in Hindawi.<br/><br/> + ${meta.authorNoteText}<br/><br/> + Thanks again for choosing to publish with us.` + replacements.hasLink = false + delete replacements.detailsUrl + replacements.signatureName = meta.handlingEditorName + textBody = `${replacements.intro} ${replacements.paragraph} ${ + replacements.signatureName + }` + break case 'he-manuscript-rejected': subject = meta.emailSubject replacements.hasLink = false @@ -486,6 +504,24 @@ module.exports = { replacements.signatureName }` break + case 'he-manuscript-published': + subject = meta.emailSubject + replacements.hasLink = false + replacements.previewText = 'a manuscript has been published' + replacements.intro = `Dear Dr. ${meta.handlingEditorName}` + + replacements.paragraph = `Thank you for your recommendation to publish the manuscript titled "${ + meta.fragment.title + }" by ${ + meta.fragment.authorName + } based on the reviews you received.<br/><br/> + I can confirm this article will now go through to publication.` + delete replacements.detailsUrl + replacements.signatureName = meta.eicName + textBody = `${replacements.intro} ${replacements.paragraph} ${ + replacements.signatureName + }` + break case 'submitting-reviewers-after-decision': subject = meta.emailSubject replacements.hasLink = false @@ -496,7 +532,9 @@ module.exports = { meta.fragment.title }" by ${ meta.fragment.authorName - }. After taking into account the reviews and the recommendation of the Handling Editor, I can confirm this article has now been rejected.<br/><br/> + }. After taking into account the reviews and the recommendation of the Handling Editor, I can confirm this article ${ + meta.emailText + }.<br/><br/> If you have any queries about this decision, then please email them to Hindawi as soon as possible.` delete replacements.detailsUrl replacements.signatureName = meta.editorName diff --git a/packages/component-manuscript-manager/src/helpers/User.js b/packages/component-manuscript-manager/src/helpers/User.js index 5d51a7ae79b9187e87dcc370a611945a7cb7858f..c9945c0ee80f60f09add3de038b360de877e56f9 100644 --- a/packages/component-manuscript-manager/src/helpers/User.js +++ b/packages/component-manuscript-manager/src/helpers/User.js @@ -64,9 +64,14 @@ const setupReviewersEmail = async ({ const subject = isSubmitted ? `${collection.customId}: Manuscript Decision` : `${collection.customId}: Manuscript ${getSubject(recommendation)}` - const emailType = isSubmitted - ? 'submitting-reviewers-after-decision' - : 'agreed-reviewers-after-recommendation' + let emailType = 'agreed-reviewers-after-recommendation' + let emailText + if (isSubmitted) { + emailType = 'submitting-reviewers-after-decision' + emailText = 'has now been rejected' + if (recommendation === 'publish') emailText = 'will now be published' + } + const eic = await getEditorInChief(UserModel) const editorName = isSubmitted ? `${eic.firstName} ${eic.lastName}` @@ -80,6 +85,7 @@ const setupReviewersEmail = async ({ editorName, emailSubject: subject, reviewerName: `${user.firstName} ${user.lastName}`, + emailText, }, }), ) @@ -174,14 +180,16 @@ const setupAuthorsEmailData = async ({ collection, comments, requestToRevision = false, + publish = false, }) => { const authorNote = comments.find(comm => comm.public === true) const content = get(authorNote, 'content') const authorNoteText = content !== undefined ? `Reason & Details: "${content}"` : '' - const emailType = requestToRevision + let emailType = requestToRevision ? 'author-request-to-revision' : 'author-manuscript-rejected' + if (publish) emailType = 'author-manuscript-published' let toAuthors = [] if (emailType === 'author-request-to-revision') { toAuthors.push({ @@ -216,16 +224,20 @@ const setupAuthorsEmailData = async ({ }) } -const setupManuscriptRejectedEmailForHe = async ({ +const setupManuscriptDecisionEmailForHe = async ({ UserModel, fragment: { title, submittingAuthor }, collection: { customId, handlingEditor }, + publish = false, }) => { const eic = await getEditorInChief(UserModel) const toEmail = handlingEditor.email + const emailType = publish + ? 'he-manuscript-published' + : 'he-manuscript-rejected' await mailService.sendNotificationEmail({ toEmail, - emailType: 'he-manuscript-rejected', + emailType, meta: { emailSubject: `${customId}: Manuscript Decision`, fragment: { @@ -259,5 +271,5 @@ module.exports = { setupEiCRecommendationEmailData, setupAuthorsEmailData, setupNoResponseReviewersEmailData, - setupManuscriptRejectedEmailForHe, + setupManuscriptDecisionEmailForHe, } diff --git a/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/post.js b/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/post.js index f3653eb33751c37e86fc16b235e4f9a4df0bdb08..f00c899edcddaf3339814de655fbc1d83246acc7 100644 --- a/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/post.js +++ b/packages/component-manuscript-manager/src/routes/fragmentsRecommendations/post.js @@ -69,12 +69,11 @@ module.exports = models => async (req, res) => { if (reqUser.editorInChief || reqUser.admin) { if (recommendation === 'return-to-handling-editor') await collectionHelper.updateStatus(collection, 'reviewCompleted') - else + else { await collectionHelper.updateFinalStatusByRecommendation( collection, recommendation, ) - if (recommendation === 'reject') { await userHelper.setupAuthorsEmailData({ baseUrl, UserModel, @@ -82,15 +81,18 @@ module.exports = models => async (req, res) => { fragment: { title, submittingAuthor }, comments: get(heRecommendation, 'comments'), requestToRevision: false, + publish: recommendation === 'publish', }) - await userHelper.setupManuscriptRejectedEmailForHe({ + await userHelper.setupManuscriptDecisionEmailForHe({ UserModel, fragment: { title, submittingAuthor }, collection: { customId: collection.customId, handlingEditor: collection.handlingEditor, }, + publish: recommendation === 'publish', }) + await userHelper.setupReviewersEmail({ UserModel, collection,