From 688e1a5fd8aa43feed31ce1451cd3e7f0b8a910a Mon Sep 17 00:00:00 2001 From: Aileen Nowak Date: Tue, 26 Oct 2021 14:43:09 +0200 Subject: [PATCH] Manually disable `forceUpgrade` when active subscription detected --- ghost/admin/app/components/gh-billing-iframe.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ghost/admin/app/components/gh-billing-iframe.js b/ghost/admin/app/components/gh-billing-iframe.js index feab172ab0..da4fab466f 100644 --- a/ghost/admin/app/components/gh-billing-iframe.js +++ b/ghost/admin/app/components/gh-billing-iframe.js @@ -98,6 +98,13 @@ export default Component.extend({ this.billing.set('subscription', data.subscription); this.billing.set('checkoutRoute', data?.checkoutRoute || '/plans'); + if (data.subscription.status === 'active' && this.config.get('hostSettings.forceUpgrade')) { + // config might not be updated after a subscription has been set to active. + // Until then assume the forceUpgrade is over and the subscription + // was activated successfully. + this.config.set('hostSettings.forceUpgrade', false); + } + // Detect if the current subscription is in a grace state and render a notification if (data.subscription.status === 'past_due' || data.subscription.status === 'unpaid') { // This notification needs to be shown to every user regardless their permissions to see billing