mechanism to report spam ips to stopforumspam

This commit is contained in:
Kyle Drake 2017-01-11 17:16:40 -06:00
parent 7be37ce595
commit bedc08cb58
10 changed files with 38 additions and 25 deletions

View file

@ -236,7 +236,7 @@ post '/admin/banhammer' do
site.ban!
deleted_count += 1
if !params[:ban_using_ips].empty? && !site.ip.empty?
if !params[:ban_using_ips].empty? && IPAddress.valid?(site.ip)
sites = Site.filter(ip: site.ip, is_banned: false).all
sites.each do |s|
next if usernames.include?(s.username)
@ -244,6 +244,16 @@ post '/admin/banhammer' do
end
ip_deleted_count += 1
end
if params[:classifier] == 'spam' || params[:classifier] == 'phishing'
next unless IPAddress.valid?(site.ip)
StopForumSpamWorker.perform_async(
username: site.username,
email: site.email,
ip: site.ip,
evidence: "#{params[:classifier]}\n#{site.screenshot_url(Site::SCREENSHOT_RESOLUTIONS.first)}"
)
end
end
flash[:success] = "#{ip_deleted_count + deleted_count} sites have been banned, including #{ip_deleted_count} matching IPs."