mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 13:23:38 +08:00
FIX: Moderators couldn't delete spammers via flag modal
This commit is contained in:
parent
cbc0afb399
commit
44081bdf73
|
@ -6,9 +6,17 @@ import AdminUser from 'admin/models/admin-user';
|
|||
import { iconHTML } from 'discourse-common/lib/icon-library';
|
||||
import { ajax } from 'discourse/lib/ajax';
|
||||
import showModal from 'discourse/lib/show-modal';
|
||||
import { getOwner } from 'discourse-common/lib/get-owner';
|
||||
|
||||
export default Ember.Service.extend({
|
||||
|
||||
init() {
|
||||
this._super();
|
||||
|
||||
// TODO: Make `siteSettings` a service that can be injected
|
||||
this.siteSettings = getOwner(this).lookup('site-settings:main');
|
||||
},
|
||||
|
||||
checkSpammer(userId) {
|
||||
return AdminUser.find(userId).then(au => this.spammerDetails(au));
|
||||
},
|
||||
|
@ -53,7 +61,13 @@ export default Ember.Service.extend({
|
|||
},
|
||||
|
||||
_deleteSpammer(adminUser) {
|
||||
return adminUser.checkEmail().then(() => {
|
||||
|
||||
// Try loading the email if the site supports it
|
||||
let tryEmail = this.siteSettings.show_email_on_profile ?
|
||||
adminUser.checkEmail() :
|
||||
Ember.RSVP.resolve();
|
||||
|
||||
return tryEmail.then(() => {
|
||||
|
||||
let message = I18n.messageFormat('flagging.delete_confirm_MF', {
|
||||
"POSTS": adminUser.get('post_count'),
|
||||
|
|
Loading…
Reference in New Issue
Block a user