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