From 19dadfd6d224fc35634bd2dc0828846109e838b6 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Tue, 9 Jan 2024 12:39:51 -0600 Subject: [PATCH] add threshold for jerk blocker for reducing change of false positive for more followed sites --- models/site.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/models/site.rb b/models/site.rb index 968ebca4..782515bd 100644 --- a/models/site.rb +++ b/models/site.rb @@ -141,6 +141,7 @@ class Site < Sequel::Model DISPOSABLE_EMAIL_BLACKLIST_PATH = File.join(DIR_ROOT, 'files', 'disposable_email_blacklist.conf') BANNED_EMAIL_BLACKLIST_PATH = File.join(DIR_ROOT, 'files', 'banned_email_blacklist.conf') + BLOCK_JERK_PERCENTAGE = 30 BLOCK_JERK_THRESHOLD = 25 MAXIMUM_TAGS = 5 MAX_USERNAME_LENGTH = 32.freeze @@ -621,7 +622,8 @@ class Site < Sequel::Model end def is_a_jerk? - blocks_dataset.count >= BLOCK_JERK_THRESHOLD + blocks_dataset_count = blocks_dataset.count + blocks_dataset_count >= BLOCK_JERK_THRESHOLD && ((blocks_dataset_count / follows_dataset.count.to_f) * 100) > BLOCK_JERK_PERCENTAGE end def blocking_site_ids