mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-02 08:13:34 +03:00
Merge pull request #3480 from jaswilli/issue-3466
Update user roles in store after owner transfer
This commit is contained in:
commit
cfcc30b65e
@ -14,7 +14,18 @@ var TransferOwnerController = Ember.Controller.extend({
|
|||||||
'id': user.get('id')
|
'id': user.get('id')
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
}).then(function () {
|
}).then(function (response) {
|
||||||
|
// manually update the roles for the users that just changed roles
|
||||||
|
// because store.pushPayload is not working with embedded relations
|
||||||
|
if (response && Ember.isArray(response.users)) {
|
||||||
|
response.users.forEach(function (userJSON) {
|
||||||
|
var user = self.store.getById('user', userJSON.id),
|
||||||
|
role = self.store.getById('role', userJSON.roles[0].id);
|
||||||
|
|
||||||
|
user.set('role', role);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
self.notifications.closePassive();
|
self.notifications.closePassive();
|
||||||
self.notifications.showSuccess('Ownership successfully transferred to ' + user.get('name'));
|
self.notifications.showSuccess('Ownership successfully transferred to ' + user.get('name'));
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user