From 052c5f62a9cd27fca152e58e375c545b8f708c77 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Wed, 12 May 2021 17:20:13 +0530 Subject: [PATCH] Fixed checkbox state not persisted in wizard closes https://github.com/TryGhost/Team/issues/676 The checkbox state for portal plans was not stored between wizard pages and kept switching back to original state. --- .../components/gh-launch-wizard/finalise.js | 4 +- .../gh-launch-wizard/set-pricing.hbs | 2 +- .../gh-launch-wizard/set-pricing.js | 42 ++++++++++++++++--- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/ghost/admin/app/components/gh-launch-wizard/finalise.js b/ghost/admin/app/components/gh-launch-wizard/finalise.js index 1c9fc6b8ec..2898713bef 100644 --- a/ghost/admin/app/components/gh-launch-wizard/finalise.js +++ b/ghost/admin/app/components/gh-launch-wizard/finalise.js @@ -23,11 +23,11 @@ export default class GhLaunchWizardFinaliseComponent extends Component { const yearlyPrice = updatedProduct.get('stripePrices').find(d => d.nickname === 'Yearly'); const portalPlans = this.settings.get('portalPlans') || []; let allowedPlans = [...portalPlans]; - if (data.isMonthlyChecked && monthlyPrice) { + if (data.isMonthlyChecked && monthlyPrice && !allowedPlans.includes(monthlyPrice.id)) { allowedPlans.push(monthlyPrice.id); } - if (data.isYearlyChecked && yearlyPrice) { + if (data.isYearlyChecked && yearlyPrice && !allowedPlans.includes(yearlyPrice.id)) { allowedPlans.push(yearlyPrice.id); } this.settings.set('portalPlans', allowedPlans); diff --git a/ghost/admin/app/components/gh-launch-wizard/set-pricing.hbs b/ghost/admin/app/components/gh-launch-wizard/set-pricing.hbs index a8edccac57..85df67f6ec 100644 --- a/ghost/admin/app/components/gh-launch-wizard/set-pricing.hbs +++ b/ghost/admin/app/components/gh-launch-wizard/set-pricing.hbs @@ -127,7 +127,7 @@ {{/if}}
- + {{!-- TODO: reset "failed" state automatically --}}