This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/plugins/chat/assets/javascripts/discourse/routes/chat-channel-info.js
Joffrey JAFFEUX 62685c1a76 DEV: refactors routes to simplify using outlet
This work will allow us to have an {{outlet}} chat.channel route and use it for threads as a sidepanel.
2023-02-06 14:27:35 +01:00

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;
}
}