2015-03-11 03:01:15 +08:00
|
|
|
import showModal from 'discourse/lib/show-modal';
|
2015-11-21 09:27:06 +08:00
|
|
|
import Group from 'discourse/models/group';
|
2015-03-11 03:01:15 +08:00
|
|
|
|
|
|
|
export default Discourse.Route.extend({
|
|
|
|
model() {
|
|
|
|
return this.modelFor('adminUser');
|
|
|
|
},
|
|
|
|
|
|
|
|
afterModel(model) {
|
|
|
|
if (this.currentUser.get('admin')) {
|
|
|
|
const self = this;
|
2015-11-21 09:27:06 +08:00
|
|
|
return Group.findAll().then(function(groups){
|
2015-03-11 03:01:15 +08:00
|
|
|
self._availableGroups = groups.filterBy('automatic', false);
|
|
|
|
return model;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
setupController(controller, model) {
|
|
|
|
controller.setProperties({
|
|
|
|
originalPrimaryGroupId: model.get('primary_group_id'),
|
|
|
|
availableGroups: this._availableGroups,
|
|
|
|
model
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
2015-04-10 06:33:37 +08:00
|
|
|
showSuspendModal(model) {
|
2016-11-16 06:09:55 +08:00
|
|
|
showModal('admin-suspend-user', { model, admin: true });
|
2015-03-11 03:01:15 +08:00
|
|
|
this.controllerFor('modal').set('modalClass', 'suspend-user-modal');
|
2017-02-21 20:45:30 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
viewActionLogs(username) {
|
2017-02-22 03:13:37 +08:00
|
|
|
const controller = this.controllerFor('adminLogs.staffActionLogs');
|
2017-02-21 20:45:30 +08:00
|
|
|
this.transitionTo('adminLogs.staffActionLogs').then(() => {
|
2017-02-22 19:54:52 +08:00
|
|
|
controller.set('filters', Ember.Object.create());
|
2017-02-22 16:01:40 +08:00
|
|
|
controller._changeFilters({ target_user: username });
|
2017-02-21 20:45:30 +08:00
|
|
|
});
|
2015-03-11 03:01:15 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|