Ghost/ghost/admin/app/routes/settings/general.js
Hannah Wolfe e4616f6840 Avoid infinite transition loop
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
2015-04-16 20:05:30 +01:00

31 lines
919 B
JavaScript

import AuthenticatedRoute from 'ghost/routes/authenticated';
import loadingIndicator from 'ghost/mixins/loading-indicator';
import CurrentUserSettings from 'ghost/mixins/current-user-settings';
import styleBody from 'ghost/mixins/style-body';
var SettingsGeneralRoute = AuthenticatedRoute.extend(styleBody, loadingIndicator, CurrentUserSettings, {
titleToken: 'General',
classNames: ['settings-view-general'],
beforeModel: function () {
return this.get('session.user')
.then(this.transitionAuthor())
.then(this.transitionEditor());
},
model: function () {
return this.store.find('setting', {type: 'blog,theme'}).then(function (records) {
return records.get('firstObject');
});
},
actions: {
save: function () {
this.get('controller').send('save');
}
}
});
export default SettingsGeneralRoute;