From 801b3f087fc4d27bb74ccd8cc3910e2007ca2e44 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Fri, 2 Dec 2022 18:28:15 +0100 Subject: [PATCH] FIX: deactivate is not called in every cases (#19301) Resets active channel each time we transition through "chat" route. --- plugins/chat/assets/javascripts/discourse/routes/chat.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/chat/assets/javascripts/discourse/routes/chat.js b/plugins/chat/assets/javascripts/discourse/routes/chat.js index 91668c537c4..9a2b222f21f 100644 --- a/plugins/chat/assets/javascripts/discourse/routes/chat.js +++ b/plugins/chat/assets/javascripts/discourse/routes/chat.js @@ -66,8 +66,6 @@ export default class ChatRoute extends DiscourseRoute { } deactivate() { - this.chat.setActiveChannel(null); - schedule("afterRender", () => { document.body.classList.remove("has-full-page-chat"); document.documentElement.classList.remove("has-full-page-chat"); @@ -77,6 +75,8 @@ export default class ChatRoute extends DiscourseRoute { @action willTransition(transition) { + this.chat.setActiveChannel(null); + if (!transition?.to?.name?.startsWith("chat.")) { this.chatStateManager.storeChatURL(); this.chat.updatePresence();