diff --git a/packages/component-user-manager/src/routes/fragmentsUsers/emails/emailCopy.js b/packages/component-user-manager/src/routes/fragmentsUsers/emails/emailCopy.js index d6e87cc86947dee0dd26537455c9ed458a929500..68132122b47e8b66bed920a01a9afcacc16ba8c6 100644 --- a/packages/component-user-manager/src/routes/fragmentsUsers/emails/emailCopy.js +++ b/packages/component-user-manager/src/routes/fragmentsUsers/emails/emailCopy.js @@ -1,8 +1,8 @@ const getEmailCopy = ({ emailType, titleText }) => { let paragraph switch (emailType) { - case 'co-author-added-to-manuscript': - paragraph = `You have been added as co-author to ${titleText}. The manuscript will become visible on your dashboard once it's submitted. Please click on the link below to access your dashboard.` + case 'author-added-to-manuscript': + paragraph = `You have been added as an author to ${titleText}. The manuscript will become visible on your dashboard once it's submitted. Please click on the link below to access your dashboard.` break case 'new-author-added-to-manuscript': paragraph = `You have been added as an author to ${titleText}. In order to gain access to the manuscript, please confirm your account and set your account details by clicking on the link below.` diff --git a/packages/component-user-manager/src/routes/fragmentsUsers/emails/notifications.js b/packages/component-user-manager/src/routes/fragmentsUsers/emails/notifications.js index 413ea4967f01a4244415681d2505edc1f7847618..9a7af8dbcd3819870c4d749ba3c85cd910db219b 100644 --- a/packages/component-user-manager/src/routes/fragmentsUsers/emails/notifications.js +++ b/packages/component-user-manager/src/routes/fragmentsUsers/emails/notifications.js @@ -9,17 +9,11 @@ const { services, Fragment, } = require('pubsweet-component-helper-service') + const { getEmailCopy } = require('./emailCopy') module.exports = { - async sendNotifications({ - user, - baseUrl, - isSubmitting, - fragment, - UserModel, - collection, - }) { + async sendNotifications({ user, baseUrl, fragment, UserModel, collection }) { const fragmentHelper = new Fragment({ fragment }) const { title } = await fragmentHelper.getFragmentData({ handlingEditor: collection.handlingEditor, @@ -44,21 +38,27 @@ module.exports = { }, }) - if (!isSubmitting) { - sendCoAuthorEmail({ email, baseUrl, user, titleText, subjectBaseText }) + if (!user.isConfirmed) { + sendNewAuthorEmail({ + email, + user, + baseUrl, + titleText, + subjectBaseText, + }) } - sendNewAuthorEmail({ + sendAddedToManuscriptEmail({ email, - user, baseUrl, + user, titleText, subjectBaseText, }) }, } -const sendCoAuthorEmail = ({ +const sendAddedToManuscriptEmail = ({ email, baseUrl, user, @@ -77,7 +77,7 @@ const sendCoAuthorEmail = ({ const { html, text } = email.getBody({ body: getEmailCopy({ - emailType: 'co-author-added-to-manuscript', + emailType: 'author-added-to-manuscript', titleText, }), }) @@ -85,13 +85,7 @@ const sendCoAuthorEmail = ({ email.sendEmail({ html, text }) } -const sendNewAuthorEmail = ({ - email, - baseUrl, - user, - titleText, - subjectBaseText, -}) => { +const sendNewAuthorEmail = ({ email, baseUrl, user, titleText }) => { email.toUser = { email: user.email, name: `${user.firstName} ${user.lastName}`, diff --git a/packages/component-user-manager/src/routes/fragmentsUsers/post.js b/packages/component-user-manager/src/routes/fragmentsUsers/post.js index acc7fe702cd70085629264f4849d90020bd8e2f3..6a7546e6f665ef1b7fb295e92c9b14a88ba8a1b8 100644 --- a/packages/component-user-manager/src/routes/fragmentsUsers/post.js +++ b/packages/component-user-manager/src/routes/fragmentsUsers/post.js @@ -98,7 +98,6 @@ module.exports = models => async (req, res) => { fragment, collection, UserModel: models.User, - isSubmitting, }) return res.status(200).json({ @@ -137,7 +136,6 @@ module.exports = models => async (req, res) => { collection, user: newUser, UserModel: models.User, - isSubmitting, }) if (!collection.owners.includes(newUser.id)) {