mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
ded6aa6ac0
closes #3426 - added transfer ownership endpoint - added owner to roles.permissible - manually removed owner from roles.browse - removed hard coded author role - fixed tests that were passing due to hard coded author role - added testUtils.setup(‚roles‘)
43 lines
No EOL
1.2 KiB
JavaScript
43 lines
No EOL
1.2 KiB
JavaScript
var TransferOwnerController = Ember.Controller.extend({
|
|
actions: {
|
|
confirmAccept: function () {
|
|
var user = this.get('model'),
|
|
url = this.get('ghostPaths.url').api('users', 'owner'),
|
|
self = this;
|
|
|
|
self.get('popover').closePopovers();
|
|
|
|
ic.ajax.request(url, {
|
|
type: 'PUT',
|
|
data: {
|
|
owner: [{
|
|
'id': user.get('id')
|
|
}]
|
|
}
|
|
}).then(function () {
|
|
self.notifications.closePassive();
|
|
self.notifications.showSuccess('Ownership successfully transferred to ' + user.get('name'));
|
|
}).catch(function (error) {
|
|
self.notifications.closePassive();
|
|
self.notifications.showAPIError(error);
|
|
});
|
|
},
|
|
|
|
confirmReject: function () {
|
|
return false;
|
|
}
|
|
},
|
|
|
|
confirm: {
|
|
accept: {
|
|
text: 'YEP - I\'M SURE',
|
|
buttonClass: 'button-delete'
|
|
},
|
|
reject: {
|
|
text: 'CANCEL',
|
|
buttonClass: 'button'
|
|
}
|
|
}
|
|
});
|
|
|
|
export default TransferOwnerController; |