mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 04:48:17 +08: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:
16
lib/ip_addr.rb
Normal file
16
lib/ip_addr.rb
Normal file
@ -0,0 +1,16 @@
|
||||
class IPAddr
|
||||
|
||||
def to_cidr_s
|
||||
if @addr
|
||||
mask = @mask_addr.to_s(2).count('1')
|
||||
if mask == 32
|
||||
to_s
|
||||
else
|
||||
"#{to_s}/#{mask}"
|
||||
end
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Reference in New Issue
Block a user