mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-20 01:03:23 +03:00
f9ac201891
refs https://github.com/TryGhost/Team/issues/3151 - handles redirection to old settings if the config for admin-x is missing and new settings route is opened
32 lines
763 B
JavaScript
32 lines
763 B
JavaScript
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default class SettingsXRoute extends AuthenticatedRoute {
|
|
@service session;
|
|
@service ui;
|
|
|
|
beforeModel() {
|
|
super.beforeModel(...arguments);
|
|
|
|
const user = this.session.user;
|
|
|
|
if (!user.isAdmin) {
|
|
return this.transitionTo('settings.staff.user', user);
|
|
}
|
|
|
|
if (!this.config.adminX?.url) {
|
|
return this.router.transitionTo('settings');
|
|
}
|
|
}
|
|
|
|
activate() {
|
|
super.activate(...arguments);
|
|
this.ui.set('isFullScreen', true);
|
|
}
|
|
|
|
deactivate() {
|
|
super.deactivate(...arguments);
|
|
this.ui.set('isFullScreen', false);
|
|
}
|
|
}
|