From 676b55826525847368bb9f3ea570a61629a45ab4 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Thu, 1 Jun 2023 19:00:54 +0200 Subject: [PATCH] FIX: correctly resubscribe after restart (#21891) Few weeks ago we implemented `onPresenceChangeCallback` to re-sync chat channels state when going back to a long time inactive tab. This codepath however contained a bug as we were reseting all subscriptions but only restarting global subscriptions and not per channel subscriptions. This commit should correctly ensure we correctly do so. It's sadly very hard to test time related changes in system specs. Co-authored-by: Martin Brennan --- .../discourse/services/chat-subscriptions-manager.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/chat/assets/javascripts/discourse/services/chat-subscriptions-manager.js b/plugins/chat/assets/javascripts/discourse/services/chat-subscriptions-manager.js index cc6f2949633..5dd75258bf7 100644 --- a/plugins/chat/assets/javascripts/discourse/services/chat-subscriptions-manager.js +++ b/plugins/chat/assets/javascripts/discourse/services/chat-subscriptions-manager.js @@ -57,6 +57,10 @@ export default class ChatSubscriptionsManager extends Service { restartChannelsSubscriptions(messageBusIds) { this.stopChannelsSubscriptions(); this.startChannelsSubscriptions(messageBusIds); + + (this.chatChannelsManager.channels || []).forEach((channel) => { + this.startChannelSubscription(channel); + }); } startChannelsSubscriptions(messageBusIds) {