mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
better tos issue reporting, and a threshold for being considered abusive in
comments
This commit is contained in:
parent
4dc613e27a
commit
e554666fc5
4 changed files with 15 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -24,3 +24,4 @@ files/disposable_email_blacklist.conf
|
|||
files/letsencrypt.key
|
||||
files/tor.txt
|
||||
.bundle
|
||||
ext/black_box.rb
|
||||
|
|
|
@ -13,9 +13,10 @@ post '/event/:event_id/comment' do |event_id|
|
|||
|
||||
site = event.site
|
||||
|
||||
if site.is_blocking?(current_site) ||
|
||||
if(site.is_blocking?(current_site) ||
|
||||
site.profile_comments_enabled == false ||
|
||||
current_site.commenting_allowed? == false
|
||||
current_site.commenting_allowed? == false ||
|
||||
(current_site.is_a_jerk? && event.site_id != current_site.id && !site.is_following?(current_site)))
|
||||
return {result: 'error'}.to_json
|
||||
end
|
||||
|
||||
|
|
|
@ -129,11 +129,12 @@ post '/site/:username/comment' do |username|
|
|||
|
||||
site = Site[username: username]
|
||||
|
||||
if(site.profile_comments_enabled == false ||
|
||||
if site.profile_comments_enabled == false ||
|
||||
params[:message].empty? ||
|
||||
site.is_blocking?(current_site) ||
|
||||
current_site.is_blocking?(site) ||
|
||||
current_site.commenting_allowed? == false)
|
||||
current_site.commenting_allowed? == false ||
|
||||
(current_site.is_a_jerk? && site.id != current_site.id && !site.is_following?(current_site))
|
||||
redirect request.referrer
|
||||
end
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue