Skip to content
Snippets Groups Projects
Commit 1a210f84 authored by Sebastian's avatar Sebastian
Browse files

feat(component-mail-service): add expected report date to reviewer email

parent c74d7d58
No related branches found
No related tags found
1 merge request!6Agree/Decline to work on a manuscript
...@@ -37,6 +37,7 @@ const setupReviewerInvitation = async ( ...@@ -37,6 +37,7 @@ const setupReviewerInvitation = async (
user, user,
mailService, mailService,
invitationId, invitationId,
invitationTimestamp,
) => { ) => {
const baseUrl = `${req.protocol}://${req.get('host')}` const baseUrl = `${req.protocol}://${req.get('host')}`
const fragment = await models.Fragment.find(collection.fragments[0]) const fragment = await models.Fragment.find(collection.fragments[0])
...@@ -52,6 +53,14 @@ const setupReviewerInvitation = async ( ...@@ -52,6 +53,14 @@ const setupReviewerInvitation = async (
let { abstract, title } = fragment.metadata let { abstract, title } = fragment.metadata
title = title.replace(/<(.|\n)*?>/g, '') title = title.replace(/<(.|\n)*?>/g, '')
abstract = abstract ? abstract.replace(/<(.|\n)*?>/g, '') : '' abstract = abstract ? abstract.replace(/<(.|\n)*?>/g, '') : ''
const date = new Date(invitationTimestamp)
let expectedDate = date.getDate() + 14
date.setDate(expectedDate)
expectedDate = date.toLocaleDateString('en-US', {
day: 'numeric',
month: 'long',
year: 'numeric',
})
await mailService.setupReviewerInvitationEmail( await mailService.setupReviewerInvitationEmail(
user, user,
baseUrl, baseUrl,
...@@ -62,6 +71,7 @@ const setupReviewerInvitation = async ( ...@@ -62,6 +71,7 @@ const setupReviewerInvitation = async (
authors, authors,
fragment.id, fragment.id,
invitationId, invitationId,
expectedDate,
) )
} }
......
...@@ -76,6 +76,7 @@ module.exports = models => async (req, res) => { ...@@ -76,6 +76,7 @@ module.exports = models => async (req, res) => {
user, user,
mailService, mailService,
invitation.id, invitation.id,
invitation.timestamp,
) )
} else { } else {
return res.status(500).json({ return res.status(500).json({
...@@ -122,6 +123,7 @@ module.exports = models => async (req, res) => { ...@@ -122,6 +123,7 @@ module.exports = models => async (req, res) => {
newUser, newUser,
mailService, mailService,
invitation.id, invitation.id,
invitation.timestamp,
) )
return res.status(200).json(newUser) return res.status(200).json(newUser)
} }
......
...@@ -147,6 +147,7 @@ module.exports = { ...@@ -147,6 +147,7 @@ module.exports = {
authors, authors,
fragmentId, fragmentId,
invitationId, invitationId,
expectedDate,
) => { ) => {
const subject = `${collection.customId}: Review Requested` const subject = `${collection.customId}: Review Requested`
let agreeUrl = `${baseUrl}/projects/${ let agreeUrl = `${baseUrl}/projects/${
...@@ -155,7 +156,11 @@ module.exports = { ...@@ -155,7 +156,11 @@ module.exports = {
invitationId, invitationId,
agree: true, agree: true,
})}` })}`
const declineUrl = '' const declineUrl = `${baseUrl}${resetPasswordPath}?${querystring.encode({
collectionId: collection.id,
agree: false,
invitationId,
})}`
if (!invitedUser.isConfirmed) { if (!invitedUser.isConfirmed) {
agreeUrl = `${baseUrl}${resetPasswordPath}?${querystring.encode({ agreeUrl = `${baseUrl}${resetPasswordPath}?${querystring.encode({
email: invitedUser.email, email: invitedUser.email,
...@@ -180,6 +185,7 @@ module.exports = { ...@@ -180,6 +185,7 @@ module.exports = {
submittingAuthor.lastName submittingAuthor.lastName
}`, }`,
authors, authors,
expectedDate,
} }
const { htmlBody, textBody } = getEmailBody('invite-reviewer', replacements) const { htmlBody, textBody } = getEmailBody('invite-reviewer', replacements)
......
...@@ -202,8 +202,7 @@ ...@@ -202,8 +202,7 @@
<tbody> <tbody>
<tr> <tr>
<td align="center" class="outer-td" style="padding:0px 0px 0px 0px"> <td align="center" class="outer-td" style="padding:0px 0px 0px 0px">
<table border="0" cellPadding="0" cellSpacing="0" class="button-css__deep-table___2OZyb wrapper-mobile" <table border="0" cellPadding="0" cellSpacing="0" class="button-css__deep-table___2OZyb wrapper-mobile" style="text-align:center">
style="text-align:center">
<tbody> <tbody>
<tr> <tr>
<td align="center" bgcolor="#0d78f2" class="inner-td" style="border-radius:6px;font-size:16px;text-align:center;background-color:inherit"> <td align="center" bgcolor="#0d78f2" class="inner-td" style="border-radius:6px;font-size:16px;text-align:center;background-color:inherit">
...@@ -238,8 +237,7 @@ ...@@ -238,8 +237,7 @@
<tbody> <tbody>
<tr> <tr>
<td align="center" class="outer-td" style="padding:0px 0px 0px 0px"> <td align="center" class="outer-td" style="padding:0px 0px 0px 0px">
<table border="0" cellPadding="0" cellSpacing="0" class="button-css__deep-table___2OZyb wrapper-mobile" <table border="0" cellPadding="0" cellSpacing="0" class="button-css__deep-table___2OZyb wrapper-mobile" style="text-align:center">
style="text-align:center">
<tbody> <tbody>
<tr> <tr>
<td align="center" bgcolor="#e4dfdf" class="inner-td" style="border-radius:6px;font-size:16px;text-align:center;background-color:inherit"> <td align="center" bgcolor="#e4dfdf" class="inner-td" style="border-radius:6px;font-size:16px;text-align:center;background-color:inherit">
...@@ -309,7 +307,9 @@ ...@@ -309,7 +307,9 @@
</p> </p>
<p>&nbsp;</p> <p>&nbsp;</p>
<p>If you are able to review the manuscript, I would be grateful if you could submit your
report by {{ expectedDate }}.</p>
<p>&nbsp;</p>
<p>With many thanks and best regards, <p>With many thanks and best regards,
<br /> {{editorName}} <br /> {{editorName}}
<br /> {{editorEmail}} <br /> {{editorEmail}}
...@@ -323,7 +323,7 @@ ...@@ -323,7 +323,7 @@
<div data-role="module-unsubscribe" class="module unsubscribe-css__unsubscribe___2CDlR" role="module" data-type="unsubscribe" <div data-role="module-unsubscribe" class="module unsubscribe-css__unsubscribe___2CDlR" role="module" data-type="unsubscribe"
style="color:#444444;font-size:12px;line-height:20px;padding:16px 16px 16px 16px;text-align:center"> style="color:#444444;font-size:12px;line-height:20px;padding:16px 16px 16px 16px;text-align:center">
<div class="Unsubscribe--addressLine"> <div class="Unsubscribe--addressLine">
<p class="Unsubscribe--senderName" style="font-family:Arial,Helvetica, sans-serif;font-size:12px;line-height:20px">[Sender_Name]</p> <p class="Unsubscribe--senderName" style="font-family:Arial,Helvetica, sans-serif;font-size:12px;line-height:20px">Hindawi Publishing Corporation</p>
<p style="font-family:Arial,Helvetica, sans-serif;font-size:12px;line-height:20px"> <p style="font-family:Arial,Helvetica, sans-serif;font-size:12px;line-height:20px">
<span class="Unsubscribe--senderAddress">315 Madison Ave, Third Floor, Suite 3070</span>, <span class="Unsubscribe--senderAddress">315 Madison Ave, Third Floor, Suite 3070</span>,
<span class="Unsubscribe--senderCity">NEW YORK</span>, <span class="Unsubscribe--senderCity">NEW YORK</span>,
......
...@@ -26,6 +26,8 @@ opportunity. For more information about our conflicts of interest policies, plea ...@@ -26,6 +26,8 @@ opportunity. For more information about our conflicts of interest policies, plea
see: see:
https://www.hindawi.com/ethics/#coi https://www.hindawi.com/ethics/#coi
If you are able to review the manuscript, I would be grateful if you could submit your report by {{ expectedDate }}.
With many thanks and best regards, With many thanks and best regards,
{{editorName}} {{editorName}}
{{editorEmail}} {{editorEmail}}
\ No newline at end of file
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