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

Failed to ignore revisions in .git-blame-ignore-revs.

27 lines
671 B
JavaScript
Raw Normal View History

import DiscourseRoute from "discourse/routes/discourse";
2018-06-15 23:03:24 +08:00
import Group from "discourse/models/group";
export default DiscourseRoute.extend({
model() {
2018-06-15 23:03:24 +08:00
return this.modelFor("adminUser");
},
afterModel(model) {
if (this.currentUser.admin) {
return Group.findAll().then(groups => {
this._availableGroups = groups.filterBy("automatic", false);
return model;
});
}
},
setupController(controller, model) {
controller.setProperties({
originalPrimaryGroupId: model.primary_group_id,
availableGroups: this._availableGroups,
customGroupIdsBuffer: model.customGroups.mapBy("id"),
model
});
}
});