FIX: saving invisible primary group field that you don't belong to

This commit is contained in:
Neil Lalonde
2017-05-17 12:42:04 -04:00
parent f8c503186e
commit a0f03936ff
3 changed files with 31 additions and 6 deletions

View File

@ -71,7 +71,12 @@ const AdminUser = Discourse.User.extend({
groupRemoved(groupId) {
return ajax("/admin/users/" + this.get('id') + "/groups/" + groupId, {
type: 'DELETE'
}).then(() => this.set('groups.[]', this.get('groups').rejectBy("id", groupId)));
}).then(() => {
this.set('groups.[]', this.get('groups').rejectBy("id", groupId));
if (this.get('primary_group_id') === groupId) {
this.set('primary_group_id', null);
}
});
},
revokeApiKey() {