Refactor StatusReachFinder to handle followers and relays as well (#16051)
This commit is contained in:
parent
6d6000f61f
commit
ca3bc1b09f
2 changed files with 29 additions and 30 deletions
|
@ -6,11 +6,22 @@ class StatusReachFinder
|
|||
end
|
||||
|
||||
def inboxes
|
||||
Account.where(id: reached_account_ids).inboxes
|
||||
(reached_account_inboxes + followers_inboxes + relay_inboxes).uniq
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def reached_account_inboxes
|
||||
# When the status is a reblog, there are no interactions with it
|
||||
# directly, we assume all interactions are with the original one
|
||||
|
||||
if @status.reblog?
|
||||
[]
|
||||
else
|
||||
Account.where(id: reached_account_ids).inboxes
|
||||
end
|
||||
end
|
||||
|
||||
def reached_account_ids
|
||||
[
|
||||
replied_to_account_id,
|
||||
|
@ -49,4 +60,16 @@ class StatusReachFinder
|
|||
def replies_account_ids
|
||||
@status.replies.pluck(:account_id)
|
||||
end
|
||||
|
||||
def followers_inboxes
|
||||
@status.account.followers.inboxes
|
||||
end
|
||||
|
||||
def relay_inboxes
|
||||
if @status.public_visibility?
|
||||
Relay.enabled.pluck(:inbox_url)
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue