Revert "DEV: Centralize user updates to a single MessageBus channel. (#17058)" (#17115)

This reverts commit 94c3bbc2d1b7bf76d823950fba16fd00b2eced08.

At this current point in time, we do not have enough data on whether
this centralisation is the trade-offs of coupling features into a single
channel.
This commit is contained in:
Alan Guo Xiang Tan
2022-06-17 12:24:15 +08:00
committed by GitHub
parent 4c810ca121
commit f618fdf17f
9 changed files with 47 additions and 85 deletions

View File

@ -179,19 +179,21 @@ describe Draft do
it 'updates draft count when a draft is created or destroyed' do
Draft.set(Fabricate(:user), Draft::NEW_TOPIC, 0, "data")
messages = MessageBus.track_publish("/user-updates/#{user.id}") do
messages = MessageBus.track_publish("/user-drafts/#{user.id}") do
Draft.set(user, Draft::NEW_TOPIC, 0, "data")
end
expect(messages.first.data[:payload][:draft_count]).to eq(1)
expect(messages.first.data[:payload][:has_topic_draft]).to eq(true)
expect(messages.first.data[:draft_count]).to eq(1)
expect(messages.first.data[:has_topic_draft]).to eq(true)
expect(messages.first.user_ids).to contain_exactly(user.id)
messages = MessageBus.track_publish("/user-updates/#{user.id}") do
messages = MessageBus.track_publish("/user-drafts/#{user.id}") do
Draft.where(user: user).destroy_all
end
expect(messages.first.data[:payload][:draft_count]).to eq(0)
expect(messages.first.data[:payload][:has_topic_draft]).to eq(false)
expect(messages.first.data[:draft_count]).to eq(0)
expect(messages.first.data[:has_topic_draft]).to eq(false)
expect(messages.first.user_ids).to contain_exactly(user.id)
end
describe '#stream' do