diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index 369df6d5f6948..c4687b02fcc40 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -84,7 +84,6 @@ def process_status @status = Status.create!(@params) attach_tags(@status) - # Delete status on zero follower user and nearly created account with include some replies if like_a_spam? @status = nil raise ActiveRecord::Rollback @@ -435,12 +434,15 @@ def increment_voters_count! retry end + SPAM_FILTER_MINIMUM_FOLLOWERS = ENV.fetch('SPAM_FILTER_MINIMUM_FOLLOWERS', 0).to_i + SPAM_FILTER_MINIMUM_CREATE_DAYS = ENV.fetch('SPAM_FILTER_MINIMUM_CREATE_DAYS', 1).to_i + SPAM_FILTER_MINIMUM_MENTIONS = ENV.fetch('SPAM_FILTER_MINIMUM_MENTIONS', 1).to_i def like_a_spam? ( !@status.account.local? && - @status.account.followers_count.zero? && - @status.account.created_at > 1.day.ago && - @mentions.count >= 2 + @status.account.followers_count > SPAM_FILTER_MINIMUM_FOLLOWERS && + @status.account.created_at > SPAM_FILTER_MINIMUM_CREATE_DAYS.day.ago && + @mentions.count > SPAM_FILTER_MINIMUM_MENTIONS ) end end