From c856d712ec31191bfdf21b2d746eb9cd51810b6c Mon Sep 17 00:00:00 2001 From: Peter Zimon Date: Thu, 10 Dec 2020 12:19:26 +0100 Subject: [PATCH] Import email refinements (#12473) * Updated import email subject * Updated import email title * Fixed copy in import email to reflect if there was at least one member added --- core/server/api/canary/members.js | 3 ++- core/server/services/members/importer/email-template.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/server/api/canary/members.js b/core/server/api/canary/members.js index ad2236bc5d..a965781ed1 100644 --- a/core/server/api/canary/members.js +++ b/core/server/api/canary/members.js @@ -379,10 +379,11 @@ module.exports = { importLabel: importLabelModel ? importLabelModel.toJSON() : null }); const errorCSV = membersService.importer.generateErrorCSV(result); + const emailSubject = result.imported > 0 ? 'Your member import is complete' : 'Your member import was unsuccessful'; await ghostMailer.send({ to: emailRecipient, - subject: importLabel.name, + subject: emailSubject, html: emailContent, forceTextContent: true, attachments: [{ diff --git a/core/server/services/members/importer/email-template.js b/core/server/services/members/importer/email-template.js index b17042eb10..a6224f530a 100644 --- a/core/server/services/members/importer/email-template.js +++ b/core/server/services/members/importer/email-template.js @@ -123,7 +123,7 @@ module.exports = ({result, siteUrl, membersUrl, emailRecipient}) => ` -

Your member import is complete

+

${iff(result.imported > 0, `Your member import is complete`, `Your member import was unsuccessful`)}

${iff(result.imported === 0 && result.errors.length === 0, ` @@ -143,12 +143,12 @@ module.exports = ({result, siteUrl, membersUrl, emailRecipient}) => `

- ${iff(result.imported === 0, `No members were added.`, `${result.errors.length} ${iff(result.errors.length === 1, `member was`, `members were`)} skipped due to errors.`)} We attached a validated CSV file in this email with the complete list of errors so that you can fix them and re-upload the CSV to complete the import.

+ ${iff(result.imported === 0, `No members were added.`, `${result.errors.length} ${iff(result.errors.length === 1, `member was`, `members were`)} skipped due to errors.`)} There's a validated CSV file attached to this email with the list of errors so that you can fix them and re-upload the CSV to complete the import.

`, '')} - View members + ${iff(result.imported > 0, `View members`, `Try again`)}