From e066fb534515ac8329692826870eb72ba2897e78 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Fri, 7 May 2021 16:14:07 +0530 Subject: [PATCH] Reverted "Added home redirect for pricing wizard" This reverts commit 0cf2fc9c24a37bfe2d1e20633e892eee36cd1712. Hiding the launch wizard when there are existing prices causes an annoying flicker on the dashboard everytime we reload the page or navigate away. Instead of handling this client side, we'll push up the logic to hide the wizard on server. --- .../components/gh-launch-wizard/set-pricing.js | 1 + ghost/admin/app/controllers/dashboard.js | 18 ------------------ ghost/admin/app/routes/launch.js | 7 ------- ghost/admin/app/templates/dashboard.hbs | 2 +- 4 files changed, 2 insertions(+), 26 deletions(-) diff --git a/ghost/admin/app/components/gh-launch-wizard/set-pricing.js b/ghost/admin/app/components/gh-launch-wizard/set-pricing.js index fb04c851e0..88af4d30ca 100644 --- a/ghost/admin/app/components/gh-launch-wizard/set-pricing.js +++ b/ghost/admin/app/components/gh-launch-wizard/set-pricing.js @@ -183,6 +183,7 @@ export default class GhLaunchWizardSetPricingComponent extends Component { ...data, product: null }); + this.args.nextStep(); } } diff --git a/ghost/admin/app/controllers/dashboard.js b/ghost/admin/app/controllers/dashboard.js index 06a500a5a2..63f734041e 100644 --- a/ghost/admin/app/controllers/dashboard.js +++ b/ghost/admin/app/controllers/dashboard.js @@ -2,7 +2,6 @@ import Controller from '@ember/controller'; import {action} from '@ember/object'; import {getSymbol} from 'ghost-admin/utils/currency'; import {inject as service} from '@ember/service'; -import {task} from 'ember-concurrency-decorators'; import {tracked} from '@glimmer/tracking'; export default class DashboardController extends Controller { @@ -36,7 +35,6 @@ export default class DashboardController extends Controller { @tracked whatsNewEntries = null; @tracked whatsNewEntriesLoading = null; @tracked whatsNewEntriesError = null; - @tracked product = null; get topMembersDataHasOpenRates() { return this.topMembersData && this.topMembersData.find((member) => { @@ -49,28 +47,12 @@ export default class DashboardController extends Controller { } initialise() { - this.loadProducts.perform(); this.loadEvents(); this.loadTopMembers(); this.loadCharts(); this.loadWhatsNew(); } - get showLaunchWizard() { - const hasPrices = this.product && this.product.get('stripePrices').length > 0; - return !this.feature.launchComplete && !hasPrices; - } - - @task({drop: true}) - *loadProducts() { - try { - const products = yield this.store.query('product', {include: 'stripe_prices'}); - this.product = products.firstObject; - } catch (e) { - this.product = null; - } - } - loadMRRStats() { this.mrrStatsLoading = true; this.membersStats.fetchMRR().then((stats) => { diff --git a/ghost/admin/app/routes/launch.js b/ghost/admin/app/routes/launch.js index 1e8013380e..d2802cc24b 100644 --- a/ghost/admin/app/routes/launch.js +++ b/ghost/admin/app/routes/launch.js @@ -6,17 +6,10 @@ export default class LaunchRoute extends AuthenticatedRoute { beforeModel() { super.beforeModel(...arguments); - return this.session.user.then((user) => { if (!user.isOwner) { return this.transitionTo('home'); } - this.store.query('product', {include: 'stripe_prices'}).then((products) => { - const defaultProduct = products.firstObject; - if (defaultProduct.get('stripePrices').length > 0) { - return this.transitionTo('home'); - } - }); }); } } diff --git a/ghost/admin/app/templates/dashboard.hbs b/ghost/admin/app/templates/dashboard.hbs index acb57fefd4..3e0025c489 100644 --- a/ghost/admin/app/templates/dashboard.hbs +++ b/ghost/admin/app/templates/dashboard.hbs @@ -7,7 +7,7 @@
- {{#if (and this.session.user.isOwner this.showLaunchWizard)}} + {{#if (and this.session.user.isOwner (not this.feature.launchComplete))}}

Select your publication style