discourse/plugins/chat/assets/javascripts/discourse/services/chat-thread-pane.js
Joffrey JAFFEUX e6c6c342d9
REFACTOR: composer/thread (#21910)
This commit contains multiple changes to improve the composer behavior especially in the context of a thread:

- Generally rename anything of the form `chatChannelThread...` to `chatThread...``
- Moves the textarea interactor instance inside the composer server
- Improves the focus state and closing of panel related to the use of the Escape shortcut
- Creates `Chat::ThreadList` as a component instead of having `Chat::Thread::ListItem` and others which could imply they were children of a the `Chat::Thread` component
2023-06-07 21:49:15 +02:00

30 lines
669 B
JavaScript

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