Add missing contexts when destroying users

This commit is contained in:
Régis Hanol 2017-11-22 15:43:54 +01:00
parent acdfb3ed03
commit 4addc5e329
4 changed files with 14 additions and 3 deletions

View File

@ -387,7 +387,14 @@ class Admin::UsersController < Admin::AdminController
params.require(:order)
user_destroyer = UserDestroyer.new(current_user)
options = { delete_posts: true, block_email: true, block_urls: true, block_ip: true, delete_as_spammer: true }
options = {
delete_posts: true,
block_email: true,
block_urls: true,
block_ip: true,
delete_as_spammer: true,
context: I18n.t("user.destroy_reasons.same_ip_address", ip_address: params[:ip])
}
AdminUserIndexQuery.new(params).find_users(50).each do |user|
user_destroyer.destroy(user, options) rescue nil

View File

@ -20,7 +20,7 @@ module Jobs
user.posts.each do |post|
post.set_owner(original_user, acting_user)
end
destroyer.destroy(user)
destroyer.destroy(user, context: I18n.t("user.destroy_reasons.fixed_primary_email"))
end
end

View File

@ -13,7 +13,7 @@ module Jobs
.find_each do |user|
begin
destroyer.destroy(user)
destroyer.destroy(user, context: I18n.t("user.destroy_reasons.unused_staged_user"))
rescue => e
Discourse.handle_job_exception(e,
message: "Cleaning up unused staged user",

View File

@ -1770,6 +1770,10 @@ en:
website:
domain_not_allowed: "Website is invalid. Allowed domains are: %{domains}"
auto_rejected: "Rejected automatically due to age. See auto_handle_queued_age site setting."
destroy_reasons:
unused_staged_user: "Unused staged user"
fixed_primary_email: "Fixed primary email for staged user"
same_ip_address: "Same IP address (%ip_address%) as other users"
flags_reminder:
flags_were_submitted: