further cleanups to filtering code

This commit is contained in:
Kyle Drake 2015-07-15 16:23:58 -07:00
parent a7ee94b0c7
commit aa56561dff
6 changed files with 52 additions and 16 deletions

View file

@ -294,6 +294,7 @@ class Site < Sequel::Model
end
def banned_ip?(ip)
return false if ENV['RACK_ENV'] == 'production' && ip == '127.0.0.1'
return true if Site.where(is_banned: true).
where(ip: hash_ip(ip)).
where(['updated_at > ?', Time.now-BANNED_TIME]).