Add: Update root status when fetching replies (#34615)

This commit is contained in:
Jonny Saunders 2025-05-12 07:54:58 -07:00 committed by GitHub
parent 4e2aa78a56
commit b709ef8ac3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 35 additions and 9 deletions

View file

@ -125,6 +125,7 @@ RSpec.describe ActivityPub::FetchAllRepliesWorker do
before do
stub_const('Status::FetchRepliesConcern::FETCH_REPLIES_ENABLED', true)
allow(FetchReplyWorker).to receive(:push_bulk)
allow(FetchReplyWorker).to receive(:perform_async)
all_items.each do |item|
next if [top_note_uri, reply_note_uri].include? item
@ -146,6 +147,12 @@ RSpec.describe ActivityPub::FetchAllRepliesWorker do
got_uris = subject.perform(status.id)
expect(got_uris).to match_array(top_items + top_items_paged)
end
it 'fetches the top status only once' do
_ = subject.perform(status.id, { request_id: 0 })
expect(FetchReplyWorker).to have_received(:perform_async).with(top_note_uri, { prefetched_body: top_object.deep_stringify_keys, request_id: 0 })
expect(a_request(:get, top_note_uri)).to have_been_made.once
end
end
describe 'perform' do