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