FIX: delete spammer modal doesn't show the email address
This commit is contained in:
parent
baee5c95ac
commit
ac069d22a9
|
@ -367,30 +367,46 @@ Discourse.AdminUser = Discourse.User.extend({
|
|||
|
||||
deleteAsSpammer: function(successCallback) {
|
||||
var user = this;
|
||||
var message = I18n.t('flagging.delete_confirm', {posts: user.get('post_count'), topics: user.get('topic_count'), email: user.get('email'), ip_address: user.get('ip_address')});
|
||||
var buttons = [{
|
||||
"label": I18n.t("composer.cancel"),
|
||||
"class": "cancel-inline",
|
||||
"link": true
|
||||
}, {
|
||||
"label": '<i class="fa fa-exclamation-triangle"></i> ' + I18n.t("flagging.yes_delete_spammer"),
|
||||
"class": "btn btn-danger",
|
||||
"callback": function() {
|
||||
Discourse.ajax("/admin/users/" + user.get('id') + '.json', {
|
||||
type: 'DELETE',
|
||||
data: {delete_posts: true, block_email: true, block_urls: true, block_ip: true, context: window.location.pathname}
|
||||
}).then(function(data) {
|
||||
if (data.deleted) {
|
||||
if (successCallback) successCallback();
|
||||
} else {
|
||||
|
||||
user.checkEmail().then(function() {
|
||||
var data = {
|
||||
posts: user.get('post_count'),
|
||||
topics: user.get('topic_count'),
|
||||
email: user.get('email') || I18n.t("flagging.hidden_email_address"),
|
||||
ip_address: user.get('ip_address') || I18n.t("flagging.ip_address_missing")
|
||||
};
|
||||
var message = I18n.t('flagging.delete_confirm', data);
|
||||
var buttons = [{
|
||||
"label": I18n.t("composer.cancel"),
|
||||
"class": "cancel-inline",
|
||||
"link": true
|
||||
}, {
|
||||
"label": '<i class="fa fa-exclamation-triangle"></i> ' + I18n.t("flagging.yes_delete_spammer"),
|
||||
"class": "btn btn-danger",
|
||||
"callback": function() {
|
||||
Discourse.ajax("/admin/users/" + user.get('id') + '.json', {
|
||||
type: 'DELETE',
|
||||
data: {
|
||||
delete_posts: true,
|
||||
block_email: true,
|
||||
block_urls: true,
|
||||
block_ip: true,
|
||||
context: window.location.pathname
|
||||
}
|
||||
}).then(function(result) {
|
||||
if (result.deleted) {
|
||||
if (successCallback) successCallback();
|
||||
} else {
|
||||
bootbox.alert(I18n.t("admin.user.delete_failed"));
|
||||
}
|
||||
}, function() {
|
||||
bootbox.alert(I18n.t("admin.user.delete_failed"));
|
||||
}
|
||||
}, function() {
|
||||
bootbox.alert(I18n.t("admin.user.delete_failed"));
|
||||
});
|
||||
}
|
||||
}];
|
||||
bootbox.dialog(message, buttons, {"classes": "flagging-delete-spammer"});
|
||||
});
|
||||
}
|
||||
}];
|
||||
bootbox.dialog(message, buttons, {"classes": "flagging-delete-spammer"});
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
loadDetails: function() {
|
||||
|
|
|
@ -416,15 +416,14 @@ Discourse.User = Discourse.Model.extend({
|
|||
return Discourse.ajax("/users/" + this.get("username_lower") + "/emails.json", {
|
||||
type: "PUT",
|
||||
data: { context: window.location.pathname }
|
||||
})
|
||||
.then(function (result) {
|
||||
}).then(function (result) {
|
||||
if (result) {
|
||||
self.setProperties({
|
||||
email: result.email,
|
||||
associated_accounts: result.associated_accounts
|
||||
});
|
||||
}
|
||||
});
|
||||
}, function () {});
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -1309,6 +1309,8 @@ en:
|
|||
delete_spammer: "Delete Spammer"
|
||||
delete_confirm: "You are about to delete <b>%{posts}</b> posts and <b>%{topics}</b> topics from this user, remove their account, block signups from their IP address <b>%{ip_address}</b>, and add their email address <b>%{email}</b> to a permanent block list. Are you sure this user is really a spammer?"
|
||||
yes_delete_spammer: "Yes, Delete Spammer"
|
||||
ip_address_missing: "(N/A)"
|
||||
hidden_email_address: "(hidden)"
|
||||
submit_tooltip: "Submit the private flag"
|
||||
take_action_tooltip: "Reach the flag threshold immediately, rather than waiting for more community flags"
|
||||
cant: "Sorry, you can't flag this post at this time."
|
||||
|
|
Loading…
Reference in New Issue