Files
Joffrey JAFFEUXandGitHub 658fa577be FIX: correctly closes panels in threads (#31013)
The following case was bugged:

- visit a thread in full page chat
- click channel title
- click back button in channel navbar
- 💥 you would have a channel with limited width as if there was
still the thread showing next to it, but it was empty
2025-01-27 16:34:56 +01:00

32 lines
728 B
JavaScript

import { action } from "@ember/object";
import { service } from "@ember/service";
import DiscourseRoute from "discourse/routes/discourse";
export default class ChatChannelThreads extends DiscourseRoute {
@service router;
@service chatThreadListPane;
@service chatStateManager;
@service chat;
beforeModel(transition) {
const channel = this.modelFor("chat.channel");
if (!channel.threadingEnabled) {
transition.abort();
this.router.transitionTo("chat.channel", ...channel.routeModels);
return;
}
}
@action
activate() {
this.chat.activeMessage = null;
this.chatStateManager.openSidePanel();
}
@action
deactivate() {
this.chatStateManager.closeSidePanel();
}
}