Ghost/core/client/app/mixins/current-user-settings.js
Hannah Wolfe b4b5e2a3f5 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

29 lines
632 B
JavaScript

import Ember from 'ember';
var CurrentUserSettings = Ember.Mixin.create({
transitionAuthor: function () {
var self = this;
return function (user) {
if (user.get('isAuthor')) {
return self.transitionTo('settings.users.user', user);
}
return user;
};
},
transitionEditor: function () {
var self = this;
return function (user) {
if (user.get('isEditor')) {
return self.transitionTo('settings.users');
}
return user;
};
}
});
export default CurrentUserSettings;