From 58759b3069ff3430f49dcb198cfd0df894f94b5f Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Wed, 21 Apr 2021 12:09:40 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Added=20option=20to=20disable=20mem?= =?UTF-8?q?ber=20subscriptions=20(#1925)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs https://github.com/TryGhost/Team/issues/579 - new Access settings screen that moves subscription access and default post visibility from the Payments settings screen - expanded "Free signup" toggle into three signup access options - "anyone" - same as previous "allow free member signup" option set to `true` - "invite only" - same as previous "allow free member signup" option set to `false` - "nobody" - completely disables member signup and login. Removes injected portal and stripe scripts on the front-end and hides member related sections on the admin dashboard (this commit moves the above changes out from behind the developer experiments flag and cleans up now-unused code) --- .../gh-launch-wizard/set-pricing.hbs | 2 +- .../gh-launch-wizard/set-pricing.js | 2 +- .../gh-members-payments-setting.hbs | 64 ------------------- .../components/gh-members-payments-setting.js | 20 ------ .../app/components/modal-portal-settings.js | 4 +- ghost/admin/app/models/setting.js | 16 +---- ghost/admin/app/templates/settings.hbs | 14 ++-- 7 files changed, 12 insertions(+), 110 deletions(-) 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 31da1f55f5..63f4ace1e2 100644 --- a/ghost/admin/app/components/gh-launch-wizard/set-pricing.hbs +++ b/ghost/admin/app/components/gh-launch-wizard/set-pricing.hbs @@ -66,7 +66,7 @@ checked={{this.isFreeChecked}} id="free-plan" name="free-plan" - disabled={{not this.settings.membersAllowFreeSignup}} + disabled={{not (eq this.settings.membersSignupAccess "all")}} class="gh-input post-settings-featured" {{on "click" this.toggleFreePlan}} data-test-checkbox="featured" 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 cefbb3ee13..b3e33e2843 100644 --- a/ghost/admin/app/components/gh-launch-wizard/set-pricing.js +++ b/ghost/admin/app/components/gh-launch-wizard/set-pricing.js @@ -46,7 +46,7 @@ export default class GhLaunchWizardSetPricingComponent extends Component { get isFreeChecked() { const allowedPlans = this.settings.get('portalPlans') || []; - return (this.settings.get('membersAllowFreeSignup') && allowedPlans.includes('free')); + return (this.settings.get('membersSignupAccess') === 'all' && allowedPlans.includes('free')); } get isMonthlyChecked() { diff --git a/ghost/admin/app/components/gh-members-payments-setting.hbs b/ghost/admin/app/components/gh-members-payments-setting.hbs index 05148fd5e5..b2a57ecc6e 100644 --- a/ghost/admin/app/components/gh-members-payments-setting.hbs +++ b/ghost/admin/app/components/gh-members-payments-setting.hbs @@ -216,70 +216,6 @@ -{{#unless (enable-developer-experiments)}} -
-

Access

-
-
-
-
-

Allow free member signup

-

If disabled, members can only be signed up via payment checkout or API integration

-
-
- -
-
-
- -
-
-
-

Default post access

-

When a new post is created, who should have access to it?

-
- -
-
- {{#liquid-if this.membersPostAccessOpen}} -
-
-
-
-
Public
- All site visitors to your site, no login required
-
-
- -
-
-
-
Members only
- All logged-in members
-
-
- -
-
-
-
Paid-members only
- Only logged-in members with an active Stripe subscription
-
-
-
- {{/liquid-if}} -
-
-
-
-{{/unless}} - {{#if this.showDisconnectStripeConnectModal}} plan.interval === 'month'); @@ -103,14 +91,6 @@ export default Component.extend({ }, actions: { - setDefaultContentVisibility(value) { - this.setDefaultContentVisibility(value); - }, - - toggleSelfSignup() { - this.set('settings.membersAllowFreeSignup', !this.get('allowSelfSignup')); - }, - setStripeDirectPublicKey(event) { this.set('settings.stripeProductName', this.get('settings.title')); this.set('settings.stripePublishableKey', event.target.value); diff --git a/ghost/admin/app/components/modal-portal-settings.js b/ghost/admin/app/components/modal-portal-settings.js index 2045d125d7..fd511bb9ca 100644 --- a/ghost/admin/app/components/modal-portal-settings.js +++ b/ghost/admin/app/components/modal-portal-settings.js @@ -1,8 +1,8 @@ import $ from 'jquery'; import ModalComponent from 'ghost-admin/components/modal-base'; import copyTextToClipboard from 'ghost-admin/utils/copy-text-to-clipboard'; -import {alias, reads} from '@ember/object/computed'; import {computed} from '@ember/object'; +import {equal, reads} from '@ember/object/computed'; import {htmlSafe} from '@ember/string'; import {run} from '@ember/runloop'; import {inject as service} from '@ember/service'; @@ -49,7 +49,7 @@ export default ModalComponent.extend({ confirm() {}, - allowSelfSignup: alias('settings.membersAllowFreeSignup'), + allowSelfSignup: equal('settings.membersSignupAccess', 'all'), isStripeConfigured: reads('membersUtils.isStripeEnabled'), diff --git a/ghost/admin/app/models/setting.js b/ghost/admin/app/models/setting.js index bdeb135c15..1145b5b675 100644 --- a/ghost/admin/app/models/setting.js +++ b/ghost/admin/app/models/setting.js @@ -1,7 +1,6 @@ /* eslint-disable camelcase */ import Model, {attr} from '@ember-data/model'; import ValidationEngine from 'ghost-admin/mixins/validation-engine'; -import {computed} from '@ember/object'; export default Model.extend(ValidationEngine, { validationType: 'setting', @@ -75,18 +74,5 @@ export default Model.extend(ValidationEngine, { newsletterShowHeader: attr('boolean'), newsletterBodyFontCategory: attr('string'), newsletterShowBadge: attr('boolean'), - newsletterFooterContent: attr('string'), - - // TODO: remove when Access screen with "Nobody" option is out of dev experiments - membersAllowFreeSignup: computed('membersSignupAccess', { - get() { - const signupAccess = this.membersSignupAccess; - return signupAccess === 'all' ? true : false; - }, - set(key, allowFreeSignup) { - const signupAccess = allowFreeSignup ? 'all' : 'invite'; - this.set('membersSignupAccess', signupAccess); - return allowFreeSignup; - } - }) + newsletterFooterContent: attr('string') }); diff --git a/ghost/admin/app/templates/settings.hbs b/ghost/admin/app/templates/settings.hbs index 1d255dcdbd..46fb479c43 100644 --- a/ghost/admin/app/templates/settings.hbs +++ b/ghost/admin/app/templates/settings.hbs @@ -40,14 +40,14 @@
Members
+ + {{svg-jar "eye"}} +
+

Access

+

Configure members usage and default access levels

+
+
{{#if (enable-developer-experiments)}} - - {{svg-jar "eye"}} -
-

Access

-

Configure members usage and default access levels

-
-
{{svg-jar "module"}}