2019-10-22 21:46:10 +08:00
|
|
|
import DiscourseRoute from "discourse/routes/discourse";
|
2018-06-15 23:03:24 +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() {
|
2018-06-15 23:03:24 +08:00
|
|
|
return this.modelFor("adminUser");
|
2015-03-11 03:01:15 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
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,
|
2019-03-22 19:46:36 +08:00
|
|
|
customGroupIdsBuffer: null,
|
2015-03-11 03:01:15 +08:00
|
|
|
model
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|