-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix deletes not reaching every server that interacted with status (#1…
…5200) Extract logic for determining ActivityPub inboxes to send deletes to to its own class and explicitly include the person the status replied to (even if not mentioned), people who favourited it, and people who replied to it (though that one is still not recursive)
- Loading branch information
Showing
2 changed files
with
97 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# frozen_string_literal: true | ||
|
||
class StatusReachFinder | ||
def initialize(status) | ||
@status = status | ||
end | ||
|
||
def inboxes | ||
Account.where(id: reached_account_ids).inboxes | ||
end | ||
|
||
private | ||
|
||
def reached_account_ids | ||
[ | ||
replied_to_account_id, | ||
reblog_of_account_id, | ||
mentioned_account_ids, | ||
reblogs_account_ids, | ||
favourites_account_ids, | ||
replies_account_ids, | ||
].tap do |arr| | ||
arr.flatten! | ||
arr.compact! | ||
arr.uniq! | ||
end | ||
end | ||
|
||
def replied_to_account_id | ||
@status.in_reply_to_account_id | ||
end | ||
|
||
def reblog_of_account_id | ||
@status.reblog.account_id if @status.reblog? | ||
end | ||
|
||
def mentioned_account_ids | ||
@status.mentions.pluck(:account_id) | ||
end | ||
|
||
def reblogs_account_ids | ||
@status.reblogs.pluck(:account_id) | ||
end | ||
|
||
def favourites_account_ids | ||
@status.favourites.pluck(:account_id) | ||
end | ||
|
||
def replies_account_ids | ||
@status.replies.pluck(:account_id) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters