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 88af4d30ca..fb04c851e0 100644 --- a/ghost/admin/app/components/gh-launch-wizard/set-pricing.js +++ b/ghost/admin/app/components/gh-launch-wizard/set-pricing.js @@ -183,7 +183,6 @@ 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 63f734041e..06a500a5a2 100644 --- a/ghost/admin/app/controllers/dashboard.js +++ b/ghost/admin/app/controllers/dashboard.js @@ -2,6 +2,7 @@ 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 { @@ -35,6 +36,7 @@ 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) => { @@ -47,12 +49,28 @@ 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 d2802cc24b..1e8013380e 100644 --- a/ghost/admin/app/routes/launch.js +++ b/ghost/admin/app/routes/launch.js @@ -6,10 +6,17 @@ 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 3e0025c489..acb57fefd4 100644 --- a/ghost/admin/app/templates/dashboard.hbs +++ b/ghost/admin/app/templates/dashboard.hbs @@ -7,7 +7,7 @@