mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: when adding an IP to the spammer list, check the broader ban list
first FEATURE: allow admins to search users using IP ranges
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
require_dependency 'ip_addr'
|
||||
|
||||
# Responsible for destroying a User record
|
||||
class UserDestroyer
|
||||
|
||||
@@ -45,16 +47,21 @@ class UserDestroyer
|
||||
|
||||
user.destroy.tap do |u|
|
||||
if u
|
||||
|
||||
if opts[:block_email]
|
||||
b = ScreenedEmail.block(u.email, ip_address: u.ip_address)
|
||||
b.record_match! if b
|
||||
end
|
||||
|
||||
if opts[:block_ip] && u.ip_address
|
||||
b.record_match! if b = ScreenedIpAddress.watch(u.ip_address)
|
||||
b = ScreenedIpAddress.watch(u.ip_address)
|
||||
b.record_match! if b
|
||||
if u.registration_ip_address && u.ip_address != u.registration_ip_address
|
||||
b.record_match! if b = ScreenedIpAddress.watch(u.registration_ip_address)
|
||||
b = ScreenedIpAddress.watch(u.registration_ip_address)
|
||||
b.record_match! if b
|
||||
end
|
||||
end
|
||||
|
||||
Post.with_deleted.where(user_id: user.id).update_all("user_id = NULL")
|
||||
|
||||
# If this user created categories, fix those up:
|
||||
|
||||
Reference in New Issue
Block a user