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
This commit is contained in:
parent
6aecf3e2a8
commit
e9d186ced6
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user