better tos issue reporting, and a threshold for being considered abusive in

comments
This commit is contained in:
Kyle Drake 2016-11-27 19:19:28 -06:00
parent 4dc613e27a
commit e554666fc5
4 changed files with 15 additions and 6 deletions

View file

@ -124,6 +124,8 @@ class Site < Sequel::Model
EMAIL_VALIDATION_CUTOFF_DATE = Time.parse('May 16, 2016')
DISPOSABLE_EMAIL_BLACKLIST_PATH = File.join(DIR_ROOT, 'files', 'disposable_email_blacklist.conf')
BLOCK_JERK_THRESHOLD = 3
def self.newsletter_sites
Site.select(:email).
exclude(email: 'nil').exclude(is_banned: true).
@ -522,6 +524,10 @@ class Site < Sequel::Model
false
end
def is_a_jerk?
blocks_dataset.count >= BLOCK_JERK_THRESHOLD
end
def blocking_site_ids
@blocking_site_ids ||= blockings_dataset.select(:site_id).all.collect {|s| s.site_id}
end
@ -1468,8 +1474,8 @@ class Site < Sequel::Model
return false
end
if pathname.extname.match HTML_REGEX
# SPAM and phishing checking code goes here
if pathname.extname.match(HTML_REGEX) && defined?(BlackBox)
BlackBox.tos_violation_check self, uploaded
end
relative_path_dir = Pathname(relative_path).dirname