Skip to content

Commit

Permalink
Prevent delivery of posts to (even more) suspended followers (mastodo…
Browse files Browse the repository at this point in the history
  • Loading branch information
oneiros authored Nov 22, 2024
1 parent 2e66dd0 commit 21a8612
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions app/lib/status_reach_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ def inboxes

def reached_account_inboxes
scope = Account.where(id: reached_account_ids)
scope.merge!(Account.without_suspended) unless unsafe?
scope.inboxes
inboxes_without_suspended_for(scope)
end

def reached_account_ids
Expand Down Expand Up @@ -71,13 +70,8 @@ def replies_account_ids
end

def followers_inboxes
if @status.in_reply_to_local_account? && distributable?
@status.account.followers.or(@status.thread.account.followers.not_domain_blocked_by_account(@status.account)).inboxes
elsif @status.direct_visibility? || @status.limited_visibility?
[]
else
@status.account.followers.inboxes
end
scope = followers_scope
inboxes_without_suspended_for(scope)
end

def relay_inboxes
Expand All @@ -95,4 +89,19 @@ def distributable?
def unsafe?
@options[:unsafe]
end

def followers_scope
if @status.in_reply_to_local_account? && distributable?
@status.account.followers.or(@status.thread.account.followers.not_domain_blocked_by_account(@status.account))
elsif @status.direct_visibility? || @status.limited_visibility?
Account.none
else
@status.account.followers
end
end

def inboxes_without_suspended_for(scope)
scope.merge!(Account.without_suspended) unless unsafe?
scope.inboxes
end
end

0 comments on commit 21a8612

Please sign in to comment.