1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00
This commit is contained in:
Matt Jankowski 2024-07-31 14:09:15 +00:00 committed by GitHub
commit f9c762ecc4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -16,6 +16,6 @@ module RegistrationHelper
end end
def ip_blocked?(remote_ip) 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
end end

View file

@ -36,7 +36,7 @@ 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 = Rails.cache.fetch(CACHE_KEY) { FastIpMap.new(severity_no_access.pluck(:ip)) }
blocked_ips_map.include?(remote_ip) blocked_ips_map.include?(remote_ip)
end end
end end