mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 07:09:48 +03:00
9000317acd
no refs When disconnecting Stripe via the stripe connect modal, we were not resetting the `stripeConnectIntegrationToken` which is used by backend to calculate properties of `stripe_connect_*` settings. This resulted in `stripe_connect_*` properties being retained in settings even after Stripe is disconnected as we keep passing the old integration token to settings API which overrides all connect settings. This change resets the stripe integration token to empty again so as its not using the old value even after modal is closed or disconnected.
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
import ModalBase from 'ghost-admin/components/modal-base';
|
|
import classic from 'ember-classic-decorator';
|
|
import {action} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
// TODO: update modals to work fully with Glimmer components
|
|
@classic
|
|
export default class ModalStripeConnect extends ModalBase {
|
|
@service settings;
|
|
|
|
@action
|
|
setStripeConnectIntegrationTokenSetting(stripeConnectIntegrationToken) {
|
|
this.settings.set('stripeConnectIntegrationToken', stripeConnectIntegrationToken);
|
|
}
|
|
|
|
@action
|
|
reset() {
|
|
// stripeConnectIntegrationToken is not a persisted value so we don't want
|
|
// to keep it around across transitions
|
|
this.settings.set('stripeConnectIntegrationToken', undefined);
|
|
}
|
|
|
|
@action
|
|
updateSuccessModifier() {
|
|
if (this.settings.get('stripeConnectAccountId')) {
|
|
if (this.modifier?.indexOf('stripe-connected') === -1) {
|
|
this.updateModifier(`${this.modifier} stripe-connected`);
|
|
}
|
|
} else {
|
|
if (this.modifier?.indexOf('stripe-connected') !== -1) {
|
|
this.updateModifier(this.modifier.replace(/\s?stripe-connected/, ''));
|
|
}
|
|
}
|
|
}
|
|
}
|