From dee5129edf39133c5519c7f4077a70d6325dd6a0 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Thu, 20 May 2021 14:43:04 +0100 Subject: [PATCH] Fixed portal preview not updating when changing from a saved "Nobody" access no issue When members signup access is saved as "none" the front-end won't inject the portal script when rendering meaning changing to "all" or "invite" in Admin will show the preview but there's no portal script injected for the portal to show up. - detect when we're switching from a saved "none" state and force a save and full refresh of the iframe --- .../admin/app/controllers/settings/membership.js | 16 ++++++++++++++++ .../admin/app/templates/settings/membership.hbs | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ghost/admin/app/controllers/settings/membership.js b/ghost/admin/app/controllers/settings/membership.js index f83c39b45b..b0d15b0c95 100644 --- a/ghost/admin/app/controllers/settings/membership.js +++ b/ghost/admin/app/controllers/settings/membership.js @@ -102,6 +102,22 @@ export default class MembersAccessController extends Controller { this.leaveSettingsTransition = null; } + @action + async membersSubscriptionAccessChanged() { + const [oldValue] = this.settings.changedAttributes().membersSignupAccess; + + if (oldValue === 'none') { + // when saved value is 'none' the server won't inject the portal script + // to work around that and show the expected portal preview we save and + // force a refresh + await this.saveSettingsTask.perform(); + this.updatePortalPreview(); + this.portalPreviewGuid = Date.now().valueOf(); + } else { + this.updatePortalPreview(); + } + } + @action setStripePlansCurrency(event) { const newCurrency = event.value; diff --git a/ghost/admin/app/templates/settings/membership.hbs b/ghost/admin/app/templates/settings/membership.hbs index c3f2f17e93..3045f633a3 100644 --- a/ghost/admin/app/templates/settings/membership.hbs +++ b/ghost/admin/app/templates/settings/membership.hbs @@ -41,7 +41,7 @@
- +