mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Fixed portal preview not updating when connecting/disconnecting Stripe
no issue - store current stripe connection status when opening the stripe connect modal and if it's different when the modal is closed force a save and refresh of the portal preview
This commit is contained in:
parent
430ba2329d
commit
03844d5b97
2 changed files with 16 additions and 9 deletions
|
@ -36,6 +36,7 @@ export default class MembersAccessController extends Controller {
|
|||
@tracked stripePlanError = '';
|
||||
|
||||
@tracked portalPreviewUrl = '';
|
||||
@tracked portalPreviewGuid = Date.now().valueOf();
|
||||
|
||||
queryParams = ['showPortalSettings'];
|
||||
|
||||
|
@ -147,11 +148,16 @@ export default class MembersAccessController extends Controller {
|
|||
|
||||
@action
|
||||
openStripeConnect() {
|
||||
this.stripeEnabledOnOpen = this.membersUtils.isStripeEnabled;
|
||||
this.showStripeConnect = true;
|
||||
}
|
||||
|
||||
@action
|
||||
closeStripeConnect() {
|
||||
async closeStripeConnect() {
|
||||
if (this.stripeEnabledOnOpen !== this.membersUtils.isStripeEnabled) {
|
||||
await this.saveSettingsTask.perform();
|
||||
this.portalPreviewGuid = Date.now().valueOf();
|
||||
}
|
||||
this.showStripeConnect = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
{{else}}
|
||||
<GhSiteIframe
|
||||
@src={{this.portalPreviewUrl}}
|
||||
@guid={{this.portalPreviewGuid}}
|
||||
@invisibleUntilLoaded={{true}}
|
||||
@onLoad={{this.portalPreviewLoaded}}
|
||||
@onDestroyed={{this.portalPreviewDestroyed}} />
|
||||
|
@ -92,8 +93,8 @@
|
|||
@id="freeWelcomePage"
|
||||
@value={{readonly this.settings.membersFreeSignupRedirect}}
|
||||
@baseUrl={{readonly this.siteUrl}}
|
||||
@setResult={{action "setFreeSignupRedirect"}}
|
||||
@validateUrl={{action "validateFreeSignupRedirect"}}
|
||||
@setResult={{this.setFreeSignupRedirect}}
|
||||
@validateUrl={{this.validateFreeSignupRedirect}}
|
||||
@placeholder={{readonly this.siteUrl}}
|
||||
/>
|
||||
<GhErrorMessage
|
||||
|
@ -116,9 +117,9 @@
|
|||
</div>
|
||||
|
||||
{{#if this.settings.stripeConnectAccountId}}
|
||||
<button type="button" class="gh-btn" {{action (toggle "paidOpen" this)}} data-test-toggle-pub-info><span>{{if this.paidOpen "Close" "Expand"}}</span></button>
|
||||
<button type="button" class="gh-btn" {{on "click" (toggle "paidOpen" this)}} data-test-toggle-pub-info><span>{{if this.paidOpen "Close" "Expand"}}</span></button>
|
||||
{{else}}
|
||||
<button type="button" class="stripe-connect {{if this.isConnectDisallowed "disabled"}}" {{action (toggle "showStripeConnect" this)}}>
|
||||
<button type="button" class="stripe-connect {{if this.isConnectDisallowed "disabled"}}" {{on "click" this.openStripeConnect}}>
|
||||
<span>Connect with Stripe</span>
|
||||
</button>
|
||||
{{/if}}
|
||||
|
@ -178,7 +179,7 @@
|
|||
@value={{readonly this.stripeYearlyAmount}}
|
||||
@type="number"
|
||||
@input={{action (mut this.stripeYearlyAmount) value="target.value"}}
|
||||
@focus-out={{action "validateStripePlans"}}
|
||||
@focus-out={{this.validateStripePlans}}
|
||||
@placeholder=''
|
||||
data-test-title-input={{true}}
|
||||
/>
|
||||
|
@ -195,8 +196,8 @@
|
|||
<GhUrlInput
|
||||
@value={{readonly this.settings.membersPaidSignupRedirect}}
|
||||
@baseUrl={{readonly this.siteUrl}}
|
||||
@setResult={{action "setPaidSignupRedirect"}}
|
||||
@validateUrl={{action "validatePaidSignupRedirect"}}
|
||||
@setResult={{this.setPaidSignupRedirect}}
|
||||
@validateUrl={{this.validatePaidSignupRedirect}}
|
||||
@placeholder={{readonly this.siteUrl}}
|
||||
/>
|
||||
<GhErrorMessage
|
||||
|
@ -245,7 +246,7 @@
|
|||
{{#if this.showStripeConnect}}
|
||||
<GhFullscreenModal
|
||||
@modal="stripe-connect"
|
||||
@close={{action "closeStripeConnect"}}
|
||||
@close={{this.closeStripeConnect}}
|
||||
@modifier="action wide stripe-connect {{if this.settings.stripeConnectAccountId "stripe-connected" ""}}" />
|
||||
{{/if}}
|
||||
</section>
|
Loading…
Add table
Reference in a new issue