diff --git a/packages/component-manuscript-manager/src/routes/fragments/notifications/notifications.js b/packages/component-manuscript-manager/src/routes/fragments/notifications/notifications.js index 3fa3d5df6bf4f2891a8b52bca3891ee7eab69cc2..4172b4e7cfd45ce23d04d1982a6caf5331a3cb50 100644 --- a/packages/component-manuscript-manager/src/routes/fragments/notifications/notifications.js +++ b/packages/component-manuscript-manager/src/routes/fragments/notifications/notifications.js @@ -1,5 +1,5 @@ const config = require('config') -const { get, isEmpty } = require('lodash') +const { get, isEmpty, tail } = require('lodash') const Email = require('@pubsweet/component-email-templating') const { @@ -73,7 +73,7 @@ module.exports = { submittingAuthor.lastName }` - const userEmailData = await Promise.all( + let userEmailData = await Promise.all( fragmentAuthors.map(async author => { const { paragraph, ...bodyProps } = getEmailCopy({ emailType: author.isSubmitting @@ -98,6 +98,10 @@ module.exports = { }), ) + if (adminOwner) { + userEmailData = tail(userEmailData) + } + userEmailData.forEach(({ author, paragraph, bodyProps }) => { const email = new Email({ type: 'user', @@ -145,7 +149,8 @@ module.exports = { }) email.content.ctaText = 'CONFIRM ACCOUNT' } - if (isEmpty(adminOwner)) return email.sendEmail() + // if (isEmpty(adminOwner)) return email.sendEmail() + return email.sendEmail() }) }, }