Use JSON.generate call for fan out service (#38222)
This commit is contained in:
parent
b7246518bf
commit
c05492ed5a
@ -171,10 +171,10 @@ class FanOutOnWriteService < BaseService
|
|||||||
end
|
end
|
||||||
|
|
||||||
def anonymous_payload
|
def anonymous_payload
|
||||||
@anonymous_payload ||= Oj.dump(
|
@anonymous_payload ||= JSON.generate({
|
||||||
event: update? ? :'status.update' : :update,
|
event: update? ? :'status.update' : :update,
|
||||||
payload: rendered_status
|
payload: rendered_status,
|
||||||
)
|
}.as_json)
|
||||||
end
|
end
|
||||||
|
|
||||||
def rendered_status
|
def rendered_status
|
||||||
|
|||||||
@ -54,11 +54,18 @@ RSpec.describe FanOutOnWriteService do
|
|||||||
.and be_in(home_feed_of(bob))
|
.and be_in(home_feed_of(bob))
|
||||||
.and be_in(home_feed_of(tom))
|
.and be_in(home_feed_of(tom))
|
||||||
|
|
||||||
expect(redis).to have_received(:publish).with('timeline:hashtag:hoge', 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:local', anything)
|
|
||||||
expect(redis).to have_received(:publish).with('timeline:public', anything)
|
expect(redis)
|
||||||
expect(redis).to have_received(:publish).with('timeline:public:local', anything)
|
.to have_received(:publish).with('timeline:hashtag:hoge', match_json_values(expected_payload))
|
||||||
expect(redis).to have_received(:publish).with('timeline:public:media', anything)
|
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
|
end
|
||||||
|
|
||||||
context 'with silenced_account_ids' do
|
context 'with silenced_account_ids' do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user