FIX: deactivate is not called in every cases (#19301)

Resets active channel each time we transition through "chat" route.
This commit is contained in:
Joffrey JAFFEUX 2022-12-02 18:28:15 +01:00 committed by GitHub
parent ef31c7df63
commit 801b3f087f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();