Skip to content
Snippets Groups Projects
Commit 36c37dc7 authored by Bogdan Cochior's avatar Bogdan Cochior
Browse files

Merge branch 'develop' of https://gitlab.coko.foundation/xpub/xpub-faraday into develop

parents d1f90f81 5b021b5f
No related branches found
No related tags found
1 merge request!10Sprint #12
...@@ -468,6 +468,24 @@ module.exports = { ...@@ -468,6 +468,24 @@ module.exports = {
replacements.signatureName replacements.signatureName
}` }`
break 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': case 'he-manuscript-rejected':
subject = meta.emailSubject subject = meta.emailSubject
replacements.hasLink = false replacements.hasLink = false
...@@ -486,6 +504,24 @@ module.exports = { ...@@ -486,6 +504,24 @@ module.exports = {
replacements.signatureName replacements.signatureName
}` }`
break 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': case 'submitting-reviewers-after-decision':
subject = meta.emailSubject subject = meta.emailSubject
replacements.hasLink = false replacements.hasLink = false
...@@ -496,7 +532,9 @@ module.exports = { ...@@ -496,7 +532,9 @@ module.exports = {
meta.fragment.title meta.fragment.title
}" by ${ }" by ${
meta.fragment.authorName 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.` If you have any queries about this decision, then please email them to Hindawi as soon as possible.`
delete replacements.detailsUrl delete replacements.detailsUrl
replacements.signatureName = meta.editorName replacements.signatureName = meta.editorName
......
...@@ -64,9 +64,14 @@ const setupReviewersEmail = async ({ ...@@ -64,9 +64,14 @@ const setupReviewersEmail = async ({
const subject = isSubmitted const subject = isSubmitted
? `${collection.customId}: Manuscript Decision` ? `${collection.customId}: Manuscript Decision`
: `${collection.customId}: Manuscript ${getSubject(recommendation)}` : `${collection.customId}: Manuscript ${getSubject(recommendation)}`
const emailType = isSubmitted let emailType = 'agreed-reviewers-after-recommendation'
? 'submitting-reviewers-after-decision' let emailText
: 'agreed-reviewers-after-recommendation' 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 eic = await getEditorInChief(UserModel)
const editorName = isSubmitted const editorName = isSubmitted
? `${eic.firstName} ${eic.lastName}` ? `${eic.firstName} ${eic.lastName}`
...@@ -80,6 +85,7 @@ const setupReviewersEmail = async ({ ...@@ -80,6 +85,7 @@ const setupReviewersEmail = async ({
editorName, editorName,
emailSubject: subject, emailSubject: subject,
reviewerName: `${user.firstName} ${user.lastName}`, reviewerName: `${user.firstName} ${user.lastName}`,
emailText,
}, },
}), }),
) )
...@@ -174,14 +180,16 @@ const setupAuthorsEmailData = async ({ ...@@ -174,14 +180,16 @@ const setupAuthorsEmailData = async ({
collection, collection,
comments, comments,
requestToRevision = false, requestToRevision = false,
publish = false,
}) => { }) => {
const authorNote = comments.find(comm => comm.public === true) const authorNote = comments.find(comm => comm.public === true)
const content = get(authorNote, 'content') const content = get(authorNote, 'content')
const authorNoteText = const authorNoteText =
content !== undefined ? `Reason & Details: "${content}"` : '' content !== undefined ? `Reason & Details: "${content}"` : ''
const emailType = requestToRevision let emailType = requestToRevision
? 'author-request-to-revision' ? 'author-request-to-revision'
: 'author-manuscript-rejected' : 'author-manuscript-rejected'
if (publish) emailType = 'author-manuscript-published'
let toAuthors = [] let toAuthors = []
if (emailType === 'author-request-to-revision') { if (emailType === 'author-request-to-revision') {
toAuthors.push({ toAuthors.push({
...@@ -216,16 +224,20 @@ const setupAuthorsEmailData = async ({ ...@@ -216,16 +224,20 @@ const setupAuthorsEmailData = async ({
}) })
} }
const setupManuscriptRejectedEmailForHe = async ({ const setupManuscriptDecisionEmailForHe = async ({
UserModel, UserModel,
fragment: { title, submittingAuthor }, fragment: { title, submittingAuthor },
collection: { customId, handlingEditor }, collection: { customId, handlingEditor },
publish = false,
}) => { }) => {
const eic = await getEditorInChief(UserModel) const eic = await getEditorInChief(UserModel)
const toEmail = handlingEditor.email const toEmail = handlingEditor.email
const emailType = publish
? 'he-manuscript-published'
: 'he-manuscript-rejected'
await mailService.sendNotificationEmail({ await mailService.sendNotificationEmail({
toEmail, toEmail,
emailType: 'he-manuscript-rejected', emailType,
meta: { meta: {
emailSubject: `${customId}: Manuscript Decision`, emailSubject: `${customId}: Manuscript Decision`,
fragment: { fragment: {
...@@ -259,5 +271,5 @@ module.exports = { ...@@ -259,5 +271,5 @@ module.exports = {
setupEiCRecommendationEmailData, setupEiCRecommendationEmailData,
setupAuthorsEmailData, setupAuthorsEmailData,
setupNoResponseReviewersEmailData, setupNoResponseReviewersEmailData,
setupManuscriptRejectedEmailForHe, setupManuscriptDecisionEmailForHe,
} }
...@@ -69,12 +69,11 @@ module.exports = models => async (req, res) => { ...@@ -69,12 +69,11 @@ module.exports = models => async (req, res) => {
if (reqUser.editorInChief || reqUser.admin) { if (reqUser.editorInChief || reqUser.admin) {
if (recommendation === 'return-to-handling-editor') if (recommendation === 'return-to-handling-editor')
await collectionHelper.updateStatus(collection, 'reviewCompleted') await collectionHelper.updateStatus(collection, 'reviewCompleted')
else else {
await collectionHelper.updateFinalStatusByRecommendation( await collectionHelper.updateFinalStatusByRecommendation(
collection, collection,
recommendation, recommendation,
) )
if (recommendation === 'reject') {
await userHelper.setupAuthorsEmailData({ await userHelper.setupAuthorsEmailData({
baseUrl, baseUrl,
UserModel, UserModel,
...@@ -82,15 +81,18 @@ module.exports = models => async (req, res) => { ...@@ -82,15 +81,18 @@ module.exports = models => async (req, res) => {
fragment: { title, submittingAuthor }, fragment: { title, submittingAuthor },
comments: get(heRecommendation, 'comments'), comments: get(heRecommendation, 'comments'),
requestToRevision: false, requestToRevision: false,
publish: recommendation === 'publish',
}) })
await userHelper.setupManuscriptRejectedEmailForHe({ await userHelper.setupManuscriptDecisionEmailForHe({
UserModel, UserModel,
fragment: { title, submittingAuthor }, fragment: { title, submittingAuthor },
collection: { collection: {
customId: collection.customId, customId: collection.customId,
handlingEditor: collection.handlingEditor, handlingEditor: collection.handlingEditor,
}, },
publish: recommendation === 'publish',
}) })
await userHelper.setupReviewersEmail({ await userHelper.setupReviewersEmail({
UserModel, UserModel,
collection, collection,
......
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