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

42 lines
1.1 KiB
Plaintext
Raw Normal View History

import showModal from 'discourse/lib/show-modal';
import Group from 'discourse/models/group';
export default Discourse.Route.extend({
model() {
return this.modelFor('adminUser');
},
afterModel(model) {
if (this.currentUser.get('admin')) {
const self = this;
return Group.findAll().then(function(groups){
self._availableGroups = groups.filterBy('automatic', false);
return model;
});
}
},
setupController(controller, model) {
controller.setProperties({
originalPrimaryGroupId: model.get('primary_group_id'),
availableGroups: this._availableGroups,
model
});
},
actions: {
showSuspendModal(model) {
2016-11-15 17:09:55 -05:00
showModal('admin-suspend-user', { model, admin: true });
this.controllerFor('modal').set('modalClass', 'suspend-user-modal');
},
viewActionLogs(username) {
2017-02-21 14:13:37 -05:00
const controller = this.controllerFor('adminLogs.staffActionLogs');
this.transitionTo('adminLogs.staffActionLogs').then(() => {
controller.set('filters', Ember.Object.create());
controller._changeFilters({ target_user: username });
});
}
}
});