mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-22 21:08:07 +01:00
Enrich coverage for IpBlock
model (#32471)
This commit is contained in:
parent
15f6336cdd
commit
66c0471515
1 changed files with 6 additions and 1 deletions
|
@ -36,9 +36,14 @@ class IpBlock < ApplicationRecord
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def blocked?(remote_ip)
|
def blocked?(remote_ip)
|
||||||
blocked_ips_map = Rails.cache.fetch(CACHE_KEY) { FastIpMap.new(IpBlock.where(severity: :no_access).pluck(:ip)) }
|
|
||||||
blocked_ips_map.include?(remote_ip)
|
blocked_ips_map.include?(remote_ip)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def blocked_ips_map
|
||||||
|
Rails.cache.fetch(CACHE_KEY) { FastIpMap.new(severity_no_access.pluck(:ip)) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Reference in a new issue