mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Use enum-generated IpBlock.severity...
scopes
This commit is contained in:
parent
598ae4f2da
commit
f344c4d0ff
2 changed files with 2 additions and 2 deletions
|
@ -16,6 +16,6 @@ module RegistrationHelper
|
|||
end
|
||||
|
||||
def ip_blocked?(remote_ip)
|
||||
IpBlock.where(severity: :sign_up_block).exists?(['ip >>= ?', remote_ip.to_s])
|
||||
IpBlock.severity_sign_up_block.exists?(['ip >>= ?', remote_ip.to_s])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,7 +36,7 @@ class IpBlock < ApplicationRecord
|
|||
|
||||
class << self
|
||||
def blocked?(remote_ip)
|
||||
blocked_ips_map = Rails.cache.fetch(CACHE_KEY) { FastIpMap.new(IpBlock.where(severity: :no_access).pluck(:ip)) }
|
||||
blocked_ips_map = Rails.cache.fetch(CACHE_KEY) { FastIpMap.new(severity_no_access.pluck(:ip)) }
|
||||
blocked_ips_map.include?(remote_ip)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue