diff --git a/ghost/admin/app/components/gh-members-lab-setting.js b/ghost/admin/app/components/gh-members-lab-setting.js index 2cfe43ce74..9bde953e05 100644 --- a/ghost/admin/app/components/gh-members-lab-setting.js +++ b/ghost/admin/app/components/gh-members-lab-setting.js @@ -29,17 +29,19 @@ export default Component.extend({ subscriptionSettings.stripeConfig = stripeProcessor.config; subscriptionSettings.allowSelfSignup = !!subscriptionSettings.allowSelfSignup; subscriptionSettings.fromAddress = subscriptionSettings.fromAddress || ''; - if (Object.keys(subscriptionSettings).includes('mailgunApiKey')) { - subscriptionSettings.mailgunApiKey = subscriptionSettings.mailgunApiKey || ''; - subscriptionSettings.mailgunDomain = subscriptionSettings.mailgunDomain || ''; - } return subscriptionSettings; }), - hasMailgunAPIKeyOption: computed('settings.membersSubscriptionSettings', function () { - let subscriptionSettings = this.parseSubscriptionSettings(this.get('settings.membersSubscriptionSettings')); - return Object.keys(subscriptionSettings).includes('mailgunApiKey'); + bulkEmailSettings: computed('settings.bulkEmailSettings', function () { + let bulkEmailSettings = this.get('settings.bulkEmailSettings') || {}; + const {apiKey = '', baseUrl = '', domain = ''} = bulkEmailSettings; + return {apiKey, baseUrl, domain}; + }), + + hasBulkEmailConfig: computed('settings.bulkEmailSettings', function () { + let bulkEmailSettings = this.get('settings.bulkEmailSettings'); + return !!bulkEmailSettings.isConfig; }), defaultContentVisibility: computed('settings.defaultContentVisibility', function () { @@ -50,6 +52,11 @@ export default Component.extend({ setDefaultContentVisibility(value) { this.setDefaultContentVisibility(value); }, + setBulkEmailSettings(key, event) { + let bulkEmailSettings = this.get('settings.bulkEmailSettings') || {}; + bulkEmailSettings[key] = event.target.value; + this.setBulkEmailSettings(bulkEmailSettings); + }, setSubscriptionSettings(key, event) { let subscriptionSettings = this.parseSubscriptionSettings(this.get('settings.membersSubscriptionSettings')); let stripeProcessor = subscriptionSettings.paymentProcessors.find((proc) => { @@ -80,12 +87,6 @@ export default Component.extend({ if (key === 'fromAddress') { subscriptionSettings.fromAddress = event.target.value; } - if (key === 'mailgunApiKey') { - subscriptionSettings.mailgunApiKey = event.target.value; - } - if (key === 'mailgunDomain') { - subscriptionSettings.mailgunDomain = event.target.value; - } this.setMembersSubscriptionSettings(subscriptionSettings); } }, diff --git a/ghost/admin/app/controllers/settings/labs.js b/ghost/admin/app/controllers/settings/labs.js index 7963d93bd4..53b146988d 100644 --- a/ghost/admin/app/controllers/settings/labs.js +++ b/ghost/admin/app/controllers/settings/labs.js @@ -163,6 +163,10 @@ export default Controller.extend({ setMembersSubscriptionSettings(subscriptionSettings) { this.set('settings.membersSubscriptionSettings', JSON.stringify(subscriptionSettings)); + }, + + setBulkEmailSettings(bulkEmailSettings) { + this.set('settings.bulkEmailSettings', bulkEmailSettings); } }, diff --git a/ghost/admin/app/templates/components/gh-members-lab-setting.hbs b/ghost/admin/app/templates/components/gh-members-lab-setting.hbs index 86ec02f68a..190835a337 100644 --- a/ghost/admin/app/templates/components/gh-members-lab-setting.hbs +++ b/ghost/admin/app/templates/components/gh-members-lab-setting.hbs @@ -185,12 +185,12 @@