discourse/app/assets/javascripts/admin/routes/admin-user-index.js.es6

26 lines
601 B
Plaintext
Raw Normal View History

2018-06-15 11:03:24 -04:00
import Group from "discourse/models/group";
export default Discourse.Route.extend({
model() {
2018-06-15 11:03:24 -04:00
return this.modelFor("adminUser");
},
afterModel(model) {
2018-06-15 11:03:24 -04:00
if (this.currentUser.get("admin")) {
const self = this;
2018-06-15 11:03:24 -04:00
return Group.findAll().then(function(groups) {
self._availableGroups = groups.filterBy("automatic", false);
return model;
});
}
},
setupController(controller, model) {
controller.setProperties({
2018-06-15 11:03:24 -04:00
originalPrimaryGroupId: model.get("primary_group_id"),
availableGroups: this._availableGroups,
model
});
}
});