Skip to content
Snippets Groups Projects
Commit 6dad946b authored by Sebastian Mihalache's avatar Sebastian Mihalache
Browse files

feat(emails): final updates for release emails

parent bd011508
No related branches found
No related tags found
2 merge requests!43Sprint #19,!39update emails content and format
Showing
with 42 additions and 39 deletions
...@@ -4,6 +4,7 @@ const { services } = require('pubsweet-component-helper-service') ...@@ -4,6 +4,7 @@ const { services } = require('pubsweet-component-helper-service')
const { getEmailCopy } = require('./emailCopy') const { getEmailCopy } = require('./emailCopy')
const confirmSignUp = config.get('confirm-signup.url') const confirmSignUp = config.get('confirm-signup.url')
const { name: journalName, staffEmail } = config.get('journal')
module.exports = { module.exports = {
sendNewUserEmail: ({ email, role }) => { sendNewUserEmail: ({ email, role }) => {
...@@ -12,6 +13,7 @@ module.exports = { ...@@ -12,6 +13,7 @@ module.exports = {
let emailType let emailType
if (role === 'Handling Editor') { if (role === 'Handling Editor') {
emailType = 'he-added-by-admin' emailType = 'he-added-by-admin'
email.fromEmail = `${journalName} <${staffEmail}>`
} else { } else {
emailType = 'user-added-by-admin' emailType = 'user-added-by-admin'
} }
......
...@@ -2,6 +2,7 @@ const config = require('config') ...@@ -2,6 +2,7 @@ const config = require('config')
const unsubscribeSlug = config.get('unsubscribe.url') const unsubscribeSlug = config.get('unsubscribe.url')
const resetPath = config.get('invite-reset-password.url') const resetPath = config.get('invite-reset-password.url')
const staffEmail = config.get('journal.staffEmail')
const { Email, services } = require('pubsweet-component-helper-service') const { Email, services } = require('pubsweet-component-helper-service')
...@@ -11,9 +12,10 @@ module.exports = { ...@@ -11,9 +12,10 @@ module.exports = {
async sendNotifications({ user, baseUrl, role, UserModel }) { async sendNotifications({ user, baseUrl, role, UserModel }) {
const email = new Email({ const email = new Email({
type: 'user', type: 'user',
fromEmail: `Hindawi <${staffEmail}>`,
toUser: { toUser: {
email: user.email, email: user.email,
name: `${user.firstName} ${user.lastName}`, name: `${user.lastName}`,
}, },
content: { content: {
ctaLink: services.createUrl(baseUrl, resetPath, { ctaLink: services.createUrl(baseUrl, resetPath, {
......
...@@ -73,6 +73,7 @@ class Email { ...@@ -73,6 +73,7 @@ class Email {
const { fromEmail: from } = this const { fromEmail: from } = this
const { email: to } = this.toUser const { email: to } = this.toUser
const { subject } = this.content const { subject } = this.content
const mailData = { const mailData = {
to, to,
text, text,
......
<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">Hindawi Publishing Corporation</p> <p class="Unsubscribe--senderName" style="font-family:Arial, Helvetica, sans-serif;font-size:12px;line-height:20px">Hindawi Limited</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">3rd Floor, Adam House, 1 Fitzroy Square</span>,
<span class="Unsubscribe--senderCity">NEW YORK</span>, <span class="Unsubscribe--senderCity">LONDON</span>,
<span class="Unsubscribe--senderState">NY</span> <span class="Unsubscribe--senderState">United Kingdom</span>
<span class="Unsubscribe--senderZip">10017</span> <span class="Unsubscribe--senderZip">W1T 5HF</span>
</p> </p>
</div> </div>
<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">
......
...@@ -4,6 +4,7 @@ const { services } = require('pubsweet-component-helper-service') ...@@ -4,6 +4,7 @@ const { services } = require('pubsweet-component-helper-service')
const { getEmailCopy } = require('./emailCopy') const { getEmailCopy } = require('./emailCopy')
const unsubscribeSlug = config.get('unsubscribe.url') const unsubscribeSlug = config.get('unsubscribe.url')
const { name: journalName, staffEmail } = config.get('journal')
module.exports = { module.exports = {
sendInvitedHEEmail: ({ sendInvitedHEEmail: ({
...@@ -23,6 +24,7 @@ module.exports = { ...@@ -23,6 +24,7 @@ module.exports = {
? `${customId}: Editor invitation cancelled` ? `${customId}: Editor invitation cancelled`
: `${customId}: Invitation to edit a manuscript` : `${customId}: Invitation to edit a manuscript`
email.fromEmail = `${journalName} <${staffEmail}>`
email.content.unsubscribeLink = services.createUrl( email.content.unsubscribeLink = services.createUrl(
baseUrl, baseUrl,
unsubscribeSlug, unsubscribeSlug,
......
...@@ -7,7 +7,7 @@ const { ...@@ -7,7 +7,7 @@ const {
Fragment, Fragment,
} = require('pubsweet-component-helper-service') } = require('pubsweet-component-helper-service')
const { helpers } = require('./helpers') const { sendInvitedHEEmail, sendEiCEmail } = require('./helpers')
module.exports = { module.exports = {
async sendNotifications({ async sendNotifications({
...@@ -52,7 +52,7 @@ module.exports = { ...@@ -52,7 +52,7 @@ module.exports = {
}) })
if (isEiC) { if (isEiC) {
helpers.sendInvitedHEEmail({ sendInvitedHEEmail({
email, email,
baseUrl, baseUrl,
eicName, eicName,
...@@ -62,7 +62,7 @@ module.exports = { ...@@ -62,7 +62,7 @@ module.exports = {
handlingEditor: invitedHE, handlingEditor: invitedHE,
}) })
} else { } else {
helpers.sendEiCEmail({ sendEiCEmail({
eic, eic,
email, email,
baseUrl, baseUrl,
......
...@@ -25,16 +25,16 @@ const getEmailCopy = ({ emailType, titleText, expectedDate, customId }) => { ...@@ -25,16 +25,16 @@ const getEmailCopy = ({ emailType, titleText, expectedDate, customId }) => {
paragraph = `Manuscript ID ${customId} has been submitted and a package has been sent. Please click on the link below to either approve or reject the manuscript:` paragraph = `Manuscript ID ${customId} has been submitted and a package has been sent. Please click on the link below to either approve or reject the manuscript:`
break break
case 'coauthors-manuscript-submitted': case 'coauthors-manuscript-submitted':
paragraph = `${titleText}<br/> paragraph = `${titleText}.<br/><br/>
To confirm the submission and view the status of the manuscript, please verify your details by clicking the link below.<br/> To confirm the submission and view the status of the manuscript, please verify your details by clicking the link below.<br/><br/>
Thank you for submitting your work to ${journalName}. <br/> Thank you for submitting your work to ${journalName}.
` `
break break
case 'submitting-author-manuscript-submitted': case 'submitting-author-manuscript-submitted':
paragraph = `Congratulations, ${titleText} has been successfully submitted to ${journalName}.<br/> paragraph = `Congratulations, ${titleText} has been successfully submitted to ${journalName}.<br/><br/>
We will confirm this submission with all authors of the manuscript, but you will be the primary recipient of communications from the journal. We will confirm this submission with all authors of the manuscript, but you will be the primary recipient of communications from the journal.
As submitting author, you will be responsible for responding to editorial queries and making updates to the manuscript. <br/> As submitting author, you will be responsible for responding to editorial queries and making updates to the manuscript. <br/><br/>
In order to view the status of the manuscript, please visit the manuscript details page.<br/> In order to view the status of the manuscript, please visit the manuscript details page.<br/><br/>
Thank you for submitting your work to ${journalName}. Thank you for submitting your work to ${journalName}.
` `
break break
......
...@@ -9,11 +9,10 @@ const { ...@@ -9,11 +9,10 @@ const {
} = require('pubsweet-component-helper-service') } = require('pubsweet-component-helper-service')
const resetPath = config.get('invite-reset-password.url') const resetPath = config.get('invite-reset-password.url')
const journalName = config.get('journal.name') const { name: journalName, staffEmail } = config.get('journal')
const { getEmailCopy } = require('./emailCopy')
const unsubscribeSlug = config.get('unsubscribe.url') const unsubscribeSlug = config.get('unsubscribe.url')
const editorialAssistantEmail = config.get('journal.staffEmail')
const { getEmailCopy } = require('./emailCopy')
module.exports = { module.exports = {
async sendNotifications({ async sendNotifications({
...@@ -37,14 +36,13 @@ module.exports = { ...@@ -37,14 +36,13 @@ module.exports = {
}) })
const { customId } = collection const { customId } = collection
const titleText = `the manuscript titled "${parsedFragment.title}" by ${
submittingAuthor.firstName
} ${submittingAuthor.lastName}`
const email = new Email({ const email = new Email({
type: 'user', type: 'user',
fromEmail: `${journalName} <${staffEmail}>`,
content: { content: {
signatureName: '', signatureName: '',
signatureJournal: journalName,
ctaLink: services.createUrl( ctaLink: services.createUrl(
baseUrl, baseUrl,
`/projects/${collection.id}/versions/${fragment.id}/details`, `/projects/${collection.id}/versions/${fragment.id}/details`,
...@@ -87,11 +85,14 @@ module.exports = { ...@@ -87,11 +85,14 @@ module.exports = {
sendAuthorsEmail({ sendAuthorsEmail({
email, email,
baseUrl, baseUrl,
titleText,
UserModel, UserModel,
fragmentId: fragment.id, fragmentId: fragment.id,
fragmentAuthors: authors, fragmentAuthors: authors,
collectionId: collection.id, collectionId: collection.id,
title: parsedFragment.title,
submittingAuthorName: `${submittingAuthor.firstName} ${
submittingAuthor.lastName
}`,
}) })
} }
}, },
...@@ -168,23 +169,17 @@ const sendReviewersEmail = async ({ ...@@ -168,23 +169,17 @@ const sendReviewersEmail = async ({
}) })
} }
const sendEQSEmail = ({ const sendEQSEmail = ({ email, eicName, baseUrl, collection }) => {
email,
eicName,
baseUrl,
collection,
subjectBaseText,
}) => {
const emailType = 'eqs-manuscript-submitted' const emailType = 'eqs-manuscript-submitted'
email.toUser = { email.toUser = {
email: editorialAssistantEmail, email: staffEmail,
name: 'Editorial Assistant', name: 'Editorial Assistant',
} }
email.content.unsubscribeLink = baseUrl email.content.unsubscribeLink = baseUrl
email.content.signatureName = eicName email.content.signatureName = eicName
email.content.subject = `${subjectBaseText} Submitted` email.content.subject = `Manuscript Submitted`
email.content.ctaLink = services.createUrl( email.content.ctaLink = services.createUrl(
baseUrl, baseUrl,
config.get('eqs-decision.url'), config.get('eqs-decision.url'),
...@@ -209,14 +204,14 @@ const sendAuthorsEmail = async ({ ...@@ -209,14 +204,14 @@ const sendAuthorsEmail = async ({
email, email,
title, title,
baseUrl, baseUrl,
customId,
UserModel, UserModel,
titleText,
fragmentId, fragmentId,
collectionId, collectionId,
fragmentAuthors, fragmentAuthors,
submittingAuthorName,
}) => { }) => {
email.content.subject = `Manuscript submitted to ${journalName}` email.content.subject = `Manuscript submitted to ${journalName}`
email.content.signatureName = ''
const userEmailData = await Promise.all( const userEmailData = await Promise.all(
fragmentAuthors.map(async author => { fragmentAuthors.map(async author => {
...@@ -225,15 +220,12 @@ const sendAuthorsEmail = async ({ ...@@ -225,15 +220,12 @@ const sendAuthorsEmail = async ({
...author, ...author,
isConfirmed: user.isConfirmed, isConfirmed: user.isConfirmed,
...getEmailCopy({ ...getEmailCopy({
customId,
emailType: author.isSubmitting emailType: author.isSubmitting
? 'submitting-author-manuscript-submitted' ? 'submitting-author-manuscript-submitted'
: 'coauthors-manuscript-submitted', : 'coauthors-manuscript-submitted',
titleText: author.isSubmitting titleText: author.isSubmitting
? titleText ? `the manuscript titled "${title}"`
: `The manuscript titled "${title}" has been submitted to ${journalName} by ${ : `The manuscript titled "${title}" has been submitted to ${journalName} by ${submittingAuthorName}`,
author.firstName
} ${author.lastName}`,
}), }),
} }
}), }),
...@@ -277,6 +269,8 @@ const sendAuthorsEmail = async ({ ...@@ -277,6 +269,8 @@ const sendAuthorsEmail = async ({
body: { body: {
paragraph: author.paragraph, paragraph: author.paragraph,
hasLink: author.hasLink, hasLink: author.hasLink,
hasIntro: author.hasIntro,
hasSignature: author.hasSignature,
}, },
}) })
email.sendEmail({ html, text }) email.sendEmail({ html, text })
......
...@@ -10,6 +10,7 @@ const { ...@@ -10,6 +10,7 @@ const {
const { getEmailCopy } = require('./emailCopy') const { getEmailCopy } = require('./emailCopy')
const unsubscribeSlug = config.get('unsubscribe.url') const unsubscribeSlug = config.get('unsubscribe.url')
const { name: journalName, staffEmail } = config.get('journal')
module.exports = { module.exports = {
async sendNotifications({ async sendNotifications({
...@@ -46,6 +47,7 @@ module.exports = { ...@@ -46,6 +47,7 @@ module.exports = {
const email = new Email({ const email = new Email({
type: 'user', type: 'user',
fromEmail: `${journalName} <${staffEmail}>`,
content: { content: {
subject, subject,
signatureName: 'EQA Team', signatureName: 'EQA Team',
......
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