2021-10-18 14:27:42 +03:00
|
|
|
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
|
|
|
import {inject as service} from '@ember/service';
|
|
|
|
|
2022-01-17 12:34:55 +03:00
|
|
|
export default class IndexRoute extends AuthenticatedRoute {
|
|
|
|
@service infinity;
|
|
|
|
@service session;
|
2021-10-18 14:27:42 +03:00
|
|
|
|
2022-01-26 17:49:50 +03:00
|
|
|
beforeModel() {
|
|
|
|
super.beforeModel(...arguments);
|
|
|
|
|
|
|
|
const user = this.session.user;
|
|
|
|
|
|
|
|
if (user.isAuthorOrContributor) {
|
|
|
|
return this.transitionTo('settings.staff.user', user);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-18 14:27:42 +03:00
|
|
|
model() {
|
|
|
|
return this.session.user;
|
2022-01-17 12:34:55 +03:00
|
|
|
}
|
2021-10-18 14:27:42 +03:00
|
|
|
|
|
|
|
setupController(controller) {
|
2022-01-17 12:34:55 +03:00
|
|
|
super.setupController(...arguments);
|
2022-08-30 18:41:48 +03:00
|
|
|
controller.backgroundUpdateTask.perform();
|
2022-01-17 12:34:55 +03:00
|
|
|
}
|
2021-10-18 14:27:42 +03:00
|
|
|
|
|
|
|
buildRouteInfoMetadata() {
|
|
|
|
return {
|
|
|
|
titleToken: 'Staff'
|
|
|
|
};
|
|
|
|
}
|
2022-01-17 12:34:55 +03:00
|
|
|
}
|