Files
Joffrey JAFFEUXandGitHub b8dfed29d5 FIX: ensures thread panel closes on escape (#29651)
`chatThreadPane.isOpened` was returning `false` when it should return `true` due to an incorrect matching on the route.

Note that visiting a thread will focus the composer and the first escape will blur the input, only the second will close the panel.
2024-11-08 09:19:24 +09:00

34 lines
767 B
JavaScript

import { service } from "@ember/service";
import ChatChannelPane from "./chat-channel-pane";
export default class ChatThreadPane extends ChatChannelPane {
@service chat;
@service router;
get thread() {
return this.channel?.activeThread;
}
get isOpened() {
return (
this.router.currentRoute.name === "chat.channel.thread" ||
this.router.currentRoute.name === "chat.channel.thread.index"
);
}
get selectedMessageIds() {
return this.thread.messagesManager.selectedMessages.mapBy("id");
}
async close() {
await this.router.transitionTo("chat.channel", ...this.channel.routeModels);
}
async open(thread) {
await this.router.transitionTo(
"chat.channel.thread",
...thread.routeModels
);
}
}