Reject spammer
This commit is contained in:
parent
1b06c5befc
commit
6e76cbb0e4
@ -84,7 +84,15 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||
ApplicationRecord.transaction do
|
||||
@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
|
||||
end
|
||||
end
|
||||
|
||||
return if @status.nil?
|
||||
|
||||
resolve_thread(@status)
|
||||
fetch_replies(@status)
|
||||
@ -445,4 +453,12 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
def like_a_spam?
|
||||
(
|
||||
!@status.account.local? &&
|
||||
@status.account.followers_count.zero? &&
|
||||
@status.account.created_at > 1.day.ago &&
|
||||
@mentions.count >= 2
|
||||
)
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user