Skip to content
Snippets Groups Projects
Commit d5af0669 authored by Tania Fecheta's avatar Tania Fecheta
Browse files

fix(notifications): send email to all authors added by admin

parent 148c6512
No related branches found
No related tags found
3 merge requests!222Sprint #26,!217Sprint #26,!204Hin 1232 send correct email to new author
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()
})
},
}
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