Use JSON.generate call for fan out service (#38222)

This commit is contained in:
Matt Jankowski authored and GitHub committed 2026-03-16 14:31:58 +00:00
1 parent b7246518bf
commit c05492ed5a
2 files changed
+15 -8

No files matched your search

+3 -3
View File
@@ -171,10 +171,10 @@ class FanOutOnWriteService < BaseService
end
def anonymous_payload
@anonymous_payload ||= Oj.dump(
@anonymous_payload ||= JSON.generate({
event: update? ? :'status.update' : :update,
payload: rendered_status
)
payload: rendered_status,
}.as_json)
end
def rendered_status
+12 -5
View File
@@ -54,11 +54,18 @@ RSpec.describe FanOutOnWriteService do
.and be_in(home_feed_of(bob))
.and be_in(home_feed_of(tom))
expect(redis).to have_received(:publish).with('timeline:hashtag:hoge', anything)
expect(redis).to have_received(:publish).with('timeline:hashtag:hoge:local', anything)
expect(redis).to have_received(:publish).with('timeline:public', anything)
expect(redis).to have_received(:publish).with('timeline:public:local', anything)
expect(redis).to have_received(:publish).with('timeline:public:media', anything)
expected_payload = { event: 'update', payload: include(id: status.id.to_s, created_at: status.created_at.iso8601(3), content: /<p>Hello/) }
expect(redis)
.to have_received(:publish).with('timeline:hashtag:hoge', match_json_values(expected_payload))
expect(redis)
.to have_received(:publish).with('timeline:hashtag:hoge:local', match_json_values(expected_payload))
expect(redis)
.to have_received(:publish).with('timeline:public', match_json_values(expected_payload))
expect(redis)
.to have_received(:publish).with('timeline:public:local', match_json_values(expected_payload))
expect(redis)
.to have_received(:publish).with('timeline:public:media', match_json_values(expected_payload))
end
context 'with silenced_account_ids' do