mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
b4b5e2a3f5
fixes #5136 - wrap notification fetch with a user role check to remove console error - move author transition down to local route for users/user so that there's no infinite loop - replace all store calls to fetch the current user with the session user instead
28 lines
942 B
JavaScript
28 lines
942 B
JavaScript
import MobileIndexRoute from 'ghost/routes/mobile-index-route';
|
|
import CurrentUserSettings from 'ghost/mixins/current-user-settings';
|
|
import mobileQuery from 'ghost/utils/mobile';
|
|
|
|
var SettingsIndexRoute = MobileIndexRoute.extend(SimpleAuth.AuthenticatedRouteMixin, CurrentUserSettings, {
|
|
titleToken: 'Settings',
|
|
|
|
// Redirect users without permission to view settings,
|
|
// and show the settings.general route unless the user
|
|
// is mobile
|
|
beforeModel: function () {
|
|
var self = this;
|
|
return this.get('session.user')
|
|
.then(this.transitionAuthor())
|
|
.then(this.transitionEditor())
|
|
.then(function () {
|
|
if (!mobileQuery.matches) {
|
|
self.transitionTo('settings.general');
|
|
}
|
|
});
|
|
},
|
|
|
|
desktopTransition: function () {
|
|
this.transitionTo('settings.general');
|
|
}
|
|
});
|
|
|
|
export default SettingsIndexRoute;
|