mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-02 08:13:34 +03:00
9760e67b3d
refs https://github.com/TryGhost/Team/issues/1295 - modal is triggered by the query param `?firstStart=true`, eg https://localhost:2368/ghost/#/?firstStart=true - clears the query param after triggering the modal so it doesn't get re-triggered after leaving and re-entering the dashboard route
35 lines
1000 B
JavaScript
35 lines
1000 B
JavaScript
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default class DashboardRoute extends AuthenticatedRoute {
|
|
@service feature;
|
|
@service modals;
|
|
|
|
beforeModel(transition) {
|
|
super.beforeModel(...arguments);
|
|
|
|
if (!this.session.user.isAdmin) {
|
|
return this.transitionTo('site');
|
|
}
|
|
|
|
if (this.feature.improvedOnboarding && transition.to?.queryParams?.firstStart === 'true') {
|
|
this.modals.open('modals/get-started');
|
|
|
|
// clear the query param so it doesn't stick around
|
|
transition.abort();
|
|
const queryParams = Object.assign({}, transition.to.queryParams, {firstStart: false});
|
|
this.transitionTo('dashboard', {queryParams});
|
|
}
|
|
}
|
|
|
|
buildRouteInfoMetadata() {
|
|
return {
|
|
mainClasses: ['gh-main-wide']
|
|
};
|
|
}
|
|
|
|
setupController() {
|
|
this.controller.initialise();
|
|
}
|
|
}
|