mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
8748895607
Closes #3764
28 lines
No EOL
1.2 KiB
JavaScript
28 lines
No EOL
1.2 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');
|
|
}),
|
|
|
|
isNotOwnersProfile: Ember.computed.not('controller.user.isOwner'),
|
|
|
|
canAssignRoles: Ember.computed.or('currentUser.isAdmin', 'currentUser.isOwner'),
|
|
|
|
canMakeOwner: Ember.computed.and('currentUser.isOwner', 'isNotOwnProfile', 'controller.user.isAdmin'),
|
|
|
|
rolesDropdownIsVisible: Ember.computed.and('isNotOwnProfile', 'canAssignRoles', 'isNotOwnersProfile'),
|
|
|
|
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; |