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