0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

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
This commit is contained in:
Kevin Ansfield 2021-05-20 14:43:04 +01:00
parent 03844d5b97
commit dee5129edf
2 changed files with 17 additions and 1 deletions

View file

@ -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;

View file

@ -41,7 +41,7 @@
</section>
<div class="gh-setting-members-access">
<Settings::MembersSubscriptionAccess @onChange={{this.updatePortalPreview}} />
<Settings::MembersSubscriptionAccess @onChange={{this.membersSubscriptionAccessChanged}} />
<Settings::MembersDefaultPostAccess />
</div>
</div>