REFACTOR: admin-user-index route (#7534)

This commit is contained in:
Joffrey JAFFEUX 2019-05-13 17:04:41 +02:00 committed by GitHub
parent 717aa764b6
commit b8db702a02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -6,10 +6,9 @@ export default Discourse.Route.extend({
},
afterModel(model) {
if (this.currentUser.get("admin")) {
const self = this;
return Group.findAll().then(function(groups) {
self._availableGroups = groups.filterBy("automatic", false);
if (this.currentUser.admin) {
return Group.findAll().then(groups => {
this._availableGroups = groups.filterBy("automatic", false);
return model;
});
}
@ -17,7 +16,7 @@ export default Discourse.Route.extend({
setupController(controller, model) {
controller.setProperties({
originalPrimaryGroupId: model.get("primary_group_id"),
originalPrimaryGroupId: model.primary_group_id,
availableGroups: this._availableGroups,
customGroupIdsBuffer: null,
model