Skip to content
Snippets Groups Projects

Hin 1232 send correct email to new author

Merged Tania Fecheta requested to merge HIN-1232-send-correct-email-to-newAuthor into develop
1 file
+ 8
3
Compare changes
  • Side-by-side
  • Inline
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()
})
},
}