From e9d186ced698f73dbf9a34b637e3842e0861a147 Mon Sep 17 00:00:00 2001 From: Naz Date: Wed, 21 Jul 2021 11:49:47 +0400 Subject: [PATCH] Refactored ghostMailer parameter refs https://github.com/TryGhost/Team/issues/916 - The constructor API should have as small of a surface as possible, there's no need to pass around whole ghostMailer instance --- ghost/members-importer/lib/importer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ghost/members-importer/lib/importer.js b/ghost/members-importer/lib/importer.js index 29a0cbec31..c905f3aebe 100644 --- a/ghost/members-importer/lib/importer.js +++ b/ghost/members-importer/lib/importer.js @@ -18,17 +18,17 @@ module.exports = class MembersCSVImporter { * @param {string} options.storagePath - The path to store CSV's in before importing * @param {Function} options.getTimezone - function returning currently configured timezone * @param {() => Object} options.getMembersApi - * @param {Object} options.ghostMailer - An instance of GhostMailer + * @param {Function} options.sendEmail - function sending an email * @param {(string) => boolean} options.isSet - Method checking if specific feature is enabled * @param {({name, at, job, data, offloaded}) => void} options.addJob - Method registering an async job * @param {Object} options.knex - An instance of the Ghost Database connection * @param {Function} options.urlFor - function generating urls */ - constructor({storagePath, getTimezone, getMembersApi, ghostMailer, isSet, addJob, knex, urlFor}) { + constructor({storagePath, getTimezone, getMembersApi, sendEmail, isSet, addJob, knex, urlFor}) { this._storagePath = storagePath; this._getTimezone = getTimezone; this._getMembersApi = getMembersApi; - this._ghostMailer = ghostMailer; + this._sendEmail = sendEmail; this._isSet = isSet; this._addJob = addJob; this._knex = knex; @@ -294,7 +294,7 @@ module.exports = class MembersCSVImporter { const errorCSV = this.generateErrorCSV(result); const emailSubject = result.imported > 0 ? 'Your member import is complete' : 'Your member import was unsuccessful'; - await this._ghostMailer.send({ + await this._sendEmail({ to: emailRecipient, subject: emailSubject, html: emailContent,