Added getNoReplyAddress settings helper

no issue

New settings method used for https://github.com/TryGhost/Ghost/pull/15877, which shouldn't belong in the member service like it currently is.
This commit is contained in:
Simon Backx 2022-11-28 18:28:15 +01:00
parent 1b784b5ec5
commit 2a832645dd
2 changed files with 15 additions and 2 deletions

View File

@ -7,7 +7,7 @@ class MembersConfigProvider {
/**
* @param {object} options
* @param {{get: (key: string) => any}} options.settingsCache
* @param {{getDefaultEmailDomain(): string, getMembersSupportAddress(): string, isStripeConnected(): boolean}} options.settingsHelpers
* @param {{getDefaultEmailDomain(): string, getMembersSupportAddress(): string, getNoReplyAddress(): string, isStripeConnected(): boolean}} options.settingsHelpers
* @param {any} options.urlUtils
*/
constructor({settingsCache, settingsHelpers, urlUtils}) {
@ -20,11 +20,17 @@ class MembersConfigProvider {
return this._settingsHelpers.getDefaultEmailDomain();
}
/**
* @deprecated Use settingsHelpers.getNoReplyAddress or settingsHelpers.getMembersSupportAddress instead
*/
getEmailFromAddress() {
// Individual from addresses are set per newsletter - this is the fallback address
return `noreply@${this.defaultEmailDomain}`;
return this._settingsHelpers.getNoReplyAddress();
}
/**
* @deprecated Use settingsHelpers.getNoReplyAddress or settingsHelpers.getMembersSupportAddress instead
*/
getEmailSupportAddress() {
return this._settingsHelpers.getMembersSupportAddress();
}
@ -33,6 +39,9 @@ class MembersConfigProvider {
return this.getEmailSupportAddress();
}
/**
* @deprecated Use settingsHelpers.isStripeConnected instead
*/
isStripeConnected() {
return this._settingsHelpers.isStripeConnected();
}

View File

@ -94,6 +94,10 @@ class SettingsHelpers {
}
return supportAddress;
}
getNoReplyAddress() {
return `noreply@${this.getDefaultEmailDomain()}`;
}
}
module.exports = SettingsHelpers;