mirror of
https://github.com/discourse/discourse.git
synced 2025-02-14 19:42:44 +08:00
![Joffrey JAFFEUX](/assets/img/avatar_default.png)
This work will allow us to have an {{outlet}} chat.channel route and use it for threads as a sidepanel.
25 lines
732 B
JavaScript
25 lines
732 B
JavaScript
import DiscourseRoute from "discourse/routes/discourse";
|
|
import { inject as service } from "@ember/service";
|
|
import { ORIGINS } from "discourse/plugins/chat/discourse/services/chat-channel-info-route-origin-manager";
|
|
import withChatChannel from "./chat-channel-decorator";
|
|
|
|
@withChatChannel
|
|
export default class ChatChannelInfoRoute extends DiscourseRoute {
|
|
@service chatChannelInfoRouteOriginManager;
|
|
|
|
activate(transition) {
|
|
const name = transition?.from?.name;
|
|
if (name) {
|
|
this.chatChannelInfoRouteOriginManager.origin = name.startsWith(
|
|
"chat.browse"
|
|
)
|
|
? ORIGINS.browse
|
|
: ORIGINS.channel;
|
|
}
|
|
}
|
|
|
|
deactivate() {
|
|
this.chatChannelInfoRouteOriginManager.origin = null;
|
|
}
|
|
}
|