FIX: Make sure marking channels read propagates to all tabs (#20802)

Instead of just marking the state read in JS for each channel
after the AJAX call, we can instead just rely on the MessageBus
user-tracking-state chat channel, and publish the state to all
the channels affected in MarkAllUserChannelsRead. This will make
it so the blue dots for the channels are cleared across all tabs.
This commit is contained in:
Martin Brennan
2023-03-24 19:12:35 +10:00
committed by GitHub
parent d2617c4904
commit 55ef4d9a98
3 changed files with 20 additions and 11 deletions

View File

@@ -128,6 +128,13 @@ RSpec.describe Chat::MarkAllUserChannelsRead do
).count
}.by(-2)
end
it "publishes tracking state for all affected channels" do
messages = MessageBus.track_publish { result }
expect(
messages.select { |m| m.channel == "/chat/user-tracking-state/#{current_user.id}" }.count,
).to eq(3)
end
end
end
end