diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-02-07 17:06:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-07 17:06:43 +0100 |
commit | 73a782391ca3bc5cbb24fb98065f6a5f4d64f22c (patch) | |
tree | 7aa478ca1bbe55a01089af1058ede61b1d0bde38 /app/controllers/activitypub | |
parent | 0d2cf3cd4a73ffcf0dfba24ea38be2e36528a4b7 (diff) |
Fix replies collection incorrectly looping (#17462)
* Refactor tests * Add tests * Fix replies collection incorrectly looping
Diffstat (limited to 'app/controllers/activitypub')
-rw-r--r-- | app/controllers/activitypub/replies_controller.rb | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/app/controllers/activitypub/replies_controller.rb b/app/controllers/activitypub/replies_controller.rb index fde6c861f..4ff7cfa08 100644 --- a/app/controllers/activitypub/replies_controller.rb +++ b/app/controllers/activitypub/replies_controller.rb @@ -63,15 +63,29 @@ class ActivityPub::RepliesController < ActivityPub::BaseController end def next_page - only_other_accounts = !(@replies&.last&.account_id == @account.id && @replies.size == DESCENDANTS_LIMIT) - - account_status_replies_url( - @account, - @status, - page: true, - min_id: only_other_accounts && !only_other_accounts? ? nil : @replies&.last&.id, - only_other_accounts: only_other_accounts - ) + if only_other_accounts? + # Only consider remote accounts + return nil if @replies.size < DESCENDANTS_LIMIT + + account_status_replies_url( + @account, + @status, + page: true, + min_id: @replies&.last&.id, + only_other_accounts: true + ) + else + # For now, we're serving only self-replies, but next page might be other accounts + next_only_other_accounts = @replies&.last&.account_id != @account.id || @replies.size < DESCENDANTS_LIMIT + + account_status_replies_url( + @account, + @status, + page: true, + min_id: next_only_other_accounts ? nil : @replies&.last&.id, + only_other_accounts: next_only_other_accounts + ) + end end def page_params |