FIX: delete spammer wasn't working in /admin/flags

This commit is contained in:
Régis Hanol 2015-11-06 11:04:10 +01:00
parent dde2fbd391
commit 30eaa0e1c5
3 changed files with 6 additions and 8 deletions

View file

@ -7,5 +7,5 @@
{{/if}}
<button title="{{i18n 'admin.flags.agree_flag_title'}}" {{action "agreeFlagKeepPost"}} class="btn"><i class="fa fa-thumbs-o-up"></i>{{i18n 'admin.flags.agree_flag'}}</button>
{{#if model.canDeleteAsSpammer}}
<button title="{{i18n 'admin.flags.delete_spammer_title'}}" {{action "deleteSpammer" user}} class="btn btn-danger"><i class="fa fa-exclamation-triangle"></i>{{i18n 'admin.flags.delete_spammer'}}</button>
<button title="{{i18n 'admin.flags.delete_spammer_title'}}" {{action "deleteSpammer" model.user}} class="btn btn-danger"><i class="fa fa-exclamation-triangle"></i>{{i18n 'admin.flags.delete_spammer'}}</button>
{{/if}}

View file

@ -1,5 +1,5 @@
<button title="{{i18n 'admin.flags.delete_post_defer_flag_title'}}" {{action "deletePostDeferFlag"}} class="btn"><i class="fa fa-trash-o"></i><i class="fa fa-external-link"></i>{{i18n 'admin.flags.delete_post_defer_flag'}}</button>
<button title="{{i18n 'admin.flags.delete_post_agree_flag_title'}}" {{action "deletePostAgreeFlag"}} class="btn"><i class="fa fa-trash-o"></i><i class="fa fa-thumbs-o-up"></i>{{i18n 'admin.flags.delete_post_agree_flag'}}</button>
{{#if model.canDeleteAsSpammer}}
<button title="{{i18n 'admin.flags.delete_spammer_title'}}" {{action "deleteSpammer" user}} class="btn btn-danger"><i class="fa fa-exclamation-triangle"></i>{{i18n 'admin.flags.delete_spammer'}}</button>
<button title="{{i18n 'admin.flags.delete_spammer_title'}}" {{action "deleteSpammer" model.user}} class="btn btn-danger"><i class="fa fa-exclamation-triangle"></i>{{i18n 'admin.flags.delete_spammer'}}</button>
{{/if}}

View file

@ -122,12 +122,10 @@ export default Ember.Controller.extend(ModalFunctionality, {
this.fetchUserDetails();
}.observes('model.username'),
fetchUserDetails: function() {
if( Discourse.User.currentProp('staff') && this.get('model.username') ) {
const flagController = this;
Discourse.AdminUser.find(this.get('model.username').toLowerCase()).then(function(user){
flagController.set('userDetails', user);
});
fetchUserDetails() {
if (Discourse.User.currentProp('staff') && this.get('model.username')) {
Discourse.AdminUser.find(this.get('model.username').toLowerCase())
.then(user => this.set('userDetails', user));
}
}