2019-10-22 09:46:10 -04:00
|
|
|
import DiscourseRoute from "discourse/routes/discourse";
|
2015-11-20 20:27:06 -05:00
|
|
|
import Group from "discourse/models/group";
|
2015-03-10 15:01:15 -04:00
|
|
|
|
2019-10-22 09:46:10 -04:00
|
|
|
export default DiscourseRoute.extend({
|
2015-03-10 15:01:15 -04:00
|
|
|
model() {
|
|
|
|
return this.modelFor("adminUser");
|
|
|
|
},
|
|
|
|
|
|
|
|
afterModel(model) {
|
2019-05-13 11:04:41 -04:00
|
|
|
if (this.currentUser.admin) {
|
|
|
|
return Group.findAll().then(groups => {
|
|
|
|
this._availableGroups = groups.filterBy("automatic", false);
|
2015-03-10 15:01:15 -04:00
|
|
|
return model;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
setupController(controller, model) {
|
|
|
|
controller.setProperties({
|
2019-05-13 11:04:41 -04:00
|
|
|
originalPrimaryGroupId: model.primary_group_id,
|
2015-03-10 15:01:15 -04:00
|
|
|
availableGroups: this._availableGroups,
|
2020-02-03 08:22:14 -05:00
|
|
|
customGroupIdsBuffer: model.customGroups.mapBy("id"),
|
2015-03-10 15:01:15 -04:00
|
|
|
model
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|