Ghost/ghost/admin/views/settings/users/user.js
Felix Rieseberg 8841623469 Admin isn't shown "make owner" option
closes #3558
- Replaced canAssignRoles as "show user" conditional with new
"canMakeOwner"
2014-08-01 13:03:26 -07:00

26 lines
1.1 KiB
JavaScript

var SettingsUserView = Ember.View.extend({
currentUser: Ember.computed.alias('controller.session.user'),
isNotOwnProfile: Ember.computed('controller.user.id', 'currentUser.id', function () {
return this.get('controller.user.id') !== this.get('currentUser.id');
}),
canAssignRoles: Ember.computed.or('currentUser.isAdmin', 'currentUser.isOwner'),
canMakeOwner: Ember.computed.and('currentUser.isOwner', 'isNotOwnProfile'),
rolesDropdownIsVisible: Ember.computed.and('isNotOwnProfile', 'canAssignRoles'),
deleteUserActionIsVisible: Ember.computed('currentUser', 'canAssignRoles', 'controller.user', function () {
if ((this.get('canAssignRoles') && this.get('isNotOwnProfile') && !this.get('controller.user.isOwner')) ||
(this.get('currentUser.isEditor') && (!this.get('isNotOwnProfile') ||
this.get('controller.user.isAuthor')))) {
return true;
}
}),
userActionsAreVisible: Ember.computed.or('deleteUserActionIsVisible', 'canMakeOwner')
});
export default SettingsUserView;