Link suspensions to the staff logs page
This commit is contained in:
parent
ee155bd4f2
commit
36d836ba40
|
@ -64,6 +64,12 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
|||
anonymize() { return this.get('model').anonymize(); },
|
||||
destroy() { return this.get('model').destroy(); },
|
||||
|
||||
viewActionLogs() {
|
||||
this.get('adminTools').showActionLogs(this, {
|
||||
target_user: this.get('model.username'),
|
||||
});
|
||||
},
|
||||
|
||||
showFlagsReceived() {
|
||||
this.get('adminTools').showFlagsReceived(this.get('model'));
|
||||
},
|
||||
|
|
|
@ -21,15 +21,5 @@ export default Discourse.Route.extend({
|
|||
availableGroups: this._availableGroups,
|
||||
model
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
viewActionLogs(username) {
|
||||
const controller = this.controllerFor('adminLogs.staffActionLogs');
|
||||
this.transitionTo('adminLogs.staffActionLogs').then(() => {
|
||||
controller.set('filters', Ember.Object.create());
|
||||
controller._changeFilters({ target_user: username });
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -17,6 +17,14 @@ export default Ember.Service.extend({
|
|||
this.siteSettings = getOwner(this).lookup('site-settings:main');
|
||||
},
|
||||
|
||||
showActionLogs(target, filters) {
|
||||
const controller = getOwner(target).lookup('controller:adminLogs.staffActionLogs');
|
||||
target.transitionToRoute('adminLogs.staffActionLogs').then(() => {
|
||||
controller.set('filters', Ember.Object.create());
|
||||
controller._changeFilters(filters);
|
||||
});
|
||||
},
|
||||
|
||||
showFlagsReceived(user) {
|
||||
showModal(`admin-flags-received`, { admin: true, model: user });
|
||||
},
|
||||
|
@ -25,6 +33,10 @@ export default Ember.Service.extend({
|
|||
return AdminUser.find(userId).then(au => this.spammerDetails(au));
|
||||
},
|
||||
|
||||
deleteUser(id) {
|
||||
AdminUser.find(id).then(user => user.destroy({ deletePosts: true }));
|
||||
},
|
||||
|
||||
spammerDetails(adminUser) {
|
||||
return {
|
||||
deleteUser: () => this._deleteSpammer(adminUser),
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
import CanCheckEmails from 'discourse/mixins/can-check-emails';
|
||||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
import User from 'discourse/models/user';
|
||||
import optionalService from 'discourse/lib/optional-service';
|
||||
|
||||
export default Ember.Controller.extend(CanCheckEmails, {
|
||||
indexStream: false,
|
||||
application: Ember.inject.controller(),
|
||||
userNotifications: Ember.inject.controller('user-notifications'),
|
||||
currentPath: Ember.computed.alias('application.currentPath'),
|
||||
adminTools: optionalService(),
|
||||
|
||||
@computed("content.username")
|
||||
viewingSelf(username) {
|
||||
|
@ -93,11 +95,15 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
|||
this.set('forceExpand', true);
|
||||
},
|
||||
|
||||
adminDelete() {
|
||||
// I really want this deferred, don't want to bring in all this code till used
|
||||
const AdminUser = requirejs('admin/models/admin-user').default;
|
||||
AdminUser.find(this.get('model.id')).then(user => user.destroy({deletePosts: true}));
|
||||
showSuspensions() {
|
||||
this.get('adminTools').showActionLogs(this, {
|
||||
target_user: this.get('model.username'),
|
||||
action_name: 'suspend_user'
|
||||
});
|
||||
},
|
||||
|
||||
adminDelete() {
|
||||
this.get('adminTools').deleteUser(this.get('model.id'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -23,7 +23,11 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
{{#if model.number_of_suspensions}}
|
||||
<div><span class="suspensions">{{model.number_of_suspensions}}</span>{{i18n 'user.staff_counters.suspensions'}}</div>
|
||||
<div>
|
||||
<a {{action "showSuspensions"}}>
|
||||
<span class="suspensions">{{model.number_of_suspensions}}</span>{{i18n 'user.staff_counters.suspensions'}}
|
||||
</a>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if model.warnings_received_count}}
|
||||
<div><span class="warnings-received">{{model.warnings_received_count}}</span>{{i18n 'user.staff_counters.warnings_received'}}</div>
|
||||
|
|
Loading…
Reference in New Issue