diff --git a/ghost/admin/.lint-todo b/ghost/admin/.lint-todo index 7f02d482e9..352ffa9f9f 100644 --- a/ghost/admin/.lint-todo +++ b/ghost/admin/.lint-todo @@ -1212,3 +1212,5 @@ remove|ember-template-lint|no-action|118|28|118|28|0eba6cead2056aa8d89e186bd0318 remove|ember-template-lint|no-action|135|19|135|19|2e591e0b5aa8f903afda1d0f2ffd2183812e6c2f|1652054400000|1662422400000|1665014400000|app/templates/editor.hbs remove|ember-template-lint|no-action|146|19|146|19|c90e6d7f98e739c3a6472176ceeecc896913f2f6|1652054400000|1662422400000|1665014400000|app/templates/editor.hbs remove|ember-template-lint|no-unused-block-params|1|0|1|0|df27de023763e49bb0cde497e82991bbfc16b1b1|1652054400000|1662422400000|1665014400000|lib/koenig-editor/addon/components/koenig-card-audio.hbs +add|ember-template-lint|no-action|20|150|20|150|d6149e8bd18677704c261b7d3e9afeaf8be9f6a6|1653350400000|1663718400000|1668906000000|app/components/modal-portal-settings.hbs +remove|ember-template-lint|no-action|20|150|20|150|d07a2c2968b7c337172eb3d189fcd004f05034d7|1652054400000|1662422400000|1665014400000|app/components/modal-portal-settings.hbs diff --git a/ghost/admin/app/components/gh-launch-wizard/set-pricing.hbs b/ghost/admin/app/components/gh-launch-wizard/set-pricing.hbs index e8cdd71652..96b724e651 100644 --- a/ghost/admin/app/components/gh-launch-wizard/set-pricing.hbs +++ b/ghost/admin/app/components/gh-launch-wizard/set-pricing.hbs @@ -121,7 +121,7 @@ id="monthly-plan" name="monthly-plan" checked={{this.isMonthlyChecked}} - disabled={{this.isPaidPriceDisabled}} + disabled={{not this.membersUtils.isStripeEnabled}} class="gh-input post-settings-featured" {{on "click" this.toggleMonthlyPlan}} data-test-checkbox="featured" @@ -140,7 +140,7 @@ id="yearly-plan" name="yearly-plan" checked={{this.isYearlyChecked}} - disabled={{this.isPaidPriceDisabled}} + disabled={{not this.membersUtils.isStripeEnabled}} class="gh-input post-settings-featured" {{on "click" this.toggleYearlyPlan}} data-test-checkbox="featured" @@ -166,4 +166,4 @@ {{if this.isHidden "Continue" "Save and continue"}}{{svg-jar "arrow-right-tail"}} - \ No newline at end of file + diff --git a/ghost/admin/app/components/gh-launch-wizard/set-pricing.js b/ghost/admin/app/components/gh-launch-wizard/set-pricing.js index 108f35ac7e..a7e5ac52f1 100644 --- a/ghost/admin/app/components/gh-launch-wizard/set-pricing.js +++ b/ghost/admin/app/components/gh-launch-wizard/set-pricing.js @@ -46,10 +46,6 @@ export default class GhLaunchWizardSetPricingComponent extends Component { return envConfig.environment !== 'development' && !/^https:/.test(siteUrl); } - get isPaidPriceDisabled() { - return !this.membersUtils.isStripeEnabled; - } - get isFreeDisabled() { return this.settings.get('membersSignupAccess') !== 'all'; } diff --git a/ghost/admin/app/components/gh-member-settings-form.hbs b/ghost/admin/app/components/gh-member-settings-form.hbs index 5e225e17e3..17f2b6742b 100644 --- a/ghost/admin/app/components/gh-member-settings-form.hbs +++ b/ghost/admin/app/components/gh-member-settings-form.hbs @@ -100,7 +100,7 @@ /> {{/if}} - {{#if this.isStripeConnected}} + {{#if this.membersUtils.paidMembersEnabled}}

Subscriptions

{{#unless this.tiers}} diff --git a/ghost/admin/app/components/gh-member-settings-form.js b/ghost/admin/app/components/gh-member-settings-form.js index 56c230b24c..ac3fedfd2a 100644 --- a/ghost/admin/app/components/gh-member-settings-form.js +++ b/ghost/admin/app/components/gh-member-settings-form.js @@ -24,12 +24,8 @@ export default class extends Component { @tracked tiersList; @tracked newslettersList; - get canShowStripeInfo() { - return !this.member.get('isNew') && this.membersUtils.isStripeEnabled; - } - get isAddComplimentaryAllowed() { - if (!this.membersUtils.isStripeEnabled) { + if (!this.membersUtils.paidMembersEnabled) { return false; } @@ -115,10 +111,6 @@ export default class extends Component { return null; } - get isStripeConnected() { - return this.settings.get('stripeConnectAccountId'); - } - @action updateNewsletterPreference(event) { if (!event.target.checked) { diff --git a/ghost/admin/app/components/gh-members-payments-setting.hbs b/ghost/admin/app/components/gh-members-payments-setting.hbs index 28b87c7eb4..ed97ed4ad3 100644 --- a/ghost/admin/app/components/gh-members-payments-setting.hbs +++ b/ghost/admin/app/components/gh-members-payments-setting.hbs @@ -131,4 +131,4 @@ @confirm={{action "disconnectStripeConnectIntegration"}} @close={{action "closeDisconnectStripeModal"}} @modifier="action wide" /> -{{/if}} \ No newline at end of file +{{/if}} diff --git a/ghost/admin/app/components/gh-members-payments-setting.js b/ghost/admin/app/components/gh-members-payments-setting.js index 7c4b5350a6..60d228c4ba 100644 --- a/ghost/admin/app/components/gh-members-payments-setting.js +++ b/ghost/admin/app/components/gh-members-payments-setting.js @@ -13,6 +13,7 @@ export default Component.extend({ ghostPaths: service(), ajax: service(), settings: service(), + membersUtils: service(), store: service(), topCurrencies: null, @@ -22,11 +23,11 @@ export default Component.extend({ _scratchStripeYearlyAmount: null, _scratchStripeMonthlyAmount: null, + stripeDirect: false, + // passed in actions setStripeConnectIntegrationTokenSetting() {}, - stripeDirect: reads('config.stripeDirect'), - /** OLD **/ stripeDirectPublicKey: reads('settings.stripePublishableKey'), stripeDirectSecretKey: reads('settings.stripeSecretKey'), @@ -59,6 +60,9 @@ export default Component.extend({ init() { this._super(...arguments); + // Allow disabling stripe direct keys if stripe is still enabled, while the config is disabled + this.updateStripeDirect(); + const noOfTopCurrencies = 5; this.set('topCurrencies', currencies.slice(0, noOfTopCurrencies).map((currency) => { return { @@ -86,12 +90,6 @@ export default Component.extend({ options: this.currencies } ]); - - if (this.stripeConnectAccountId) { - this.set('membersStripeOpen', false); - } else { - this.set('membersStripeOpen', true); - } }, actions: { @@ -154,13 +152,14 @@ export default Component.extend({ disconnectStripeConnectIntegration() { this.disconnectStripeConnectIntegration.perform(); - }, - - openStripeSettings() { - this.set('membersStripeOpen', true); } }, + updateStripeDirect() { + // Allow disabling stripe direct keys if stripe is still enabled, while the config is disabled + this.set('stripeDirect', this.get('config.stripeDirect') || (this.get('membersUtils.isStripeEnabled') && !this.get('settings.stripeConnectAccountId'))); + }, + validateStripePlans() { this.get('settings.errors').remove('stripePlans'); this.get('settings.hasValidated').removeObject('stripePlans'); @@ -274,7 +273,6 @@ export default Component.extend({ response = yield this.settings.save(); - this.set('membersStripeOpen', false); this.set('stripeConnectSuccess', true); this.onConnected?.(); @@ -292,7 +290,9 @@ export default Component.extend({ }).drop(), saveSettings: task(function* () { - return yield this.settings.save(); + const s = yield this.settings.save(); + this.updateStripeDirect(); + return s; }).drop(), get liveStripeConnectAuthUrl() { diff --git a/ghost/admin/app/components/gh-nav-menu/main.hbs b/ghost/admin/app/components/gh-nav-menu/main.hbs index a29ab0a403..e000ced2c2 100644 --- a/ghost/admin/app/components/gh-nav-menu/main.hbs +++ b/ghost/admin/app/components/gh-nav-menu/main.hbs @@ -106,7 +106,7 @@ {{/if}} - {{#if (and this.isStripeConnected (not-eq this.settings.membersSignupAccess "none"))}} + {{#if (and this.settings.paidMembersEnabled)}}
  • {{svg-jar "percentage"}}Offers
  • diff --git a/ghost/admin/app/components/gh-nav-menu/main.js b/ghost/admin/app/components/gh-nav-menu/main.js index 96bf7e33d2..cba10dc028 100644 --- a/ghost/admin/app/components/gh-nav-menu/main.js +++ b/ghost/admin/app/components/gh-nav-menu/main.js @@ -54,9 +54,6 @@ export default class Main extends Component.extend(ShortcutsMixin) { @reads('config.hostSettings.billing.enabled') showBilling; - @reads('settings.stripeConnectAccountId') - isStripeConnected; - init() { super.init(...arguments); diff --git a/ghost/admin/app/components/members/filter.js b/ghost/admin/app/components/members/filter.js index 0a3254145f..5dfc2eef93 100644 --- a/ghost/admin/app/components/members/filter.js +++ b/ghost/admin/app/components/members/filter.js @@ -167,7 +167,7 @@ export default class MembersFilter extends Component { }); // exclude subscription filters if Stripe isn't connected - if (!this.settings.get('stripeConnectAccountId')) { + if (!this.settings.get('paidMembersEnabled')) { availableFilters = availableFilters.reject(prop => prop.group === 'Subscription'); } diff --git a/ghost/admin/app/components/modal-portal-settings.hbs b/ghost/admin/app/components/modal-portal-settings.hbs index 7b221af937..b5267fe159 100644 --- a/ghost/admin/app/components/modal-portal-settings.hbs +++ b/ghost/admin/app/components/modal-portal-settings.hbs @@ -17,7 +17,7 @@ {{#liquid-if isOpen}}