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-draft-channel.js
Martin Brennan c9776fe84d
DEV: Change setActiveChannel to get/set in services/chat (#20237)
Per PR comment in #20209, we don't need to do setActiveChannel,
we can just use native get/set instead.
2023-02-10 11:41:29 +01:00

17 lines
358 B
JavaScript

import DiscourseRoute from "discourse/routes/discourse";
import { inject as service } from "@ember/service";
export default class ChatDraftChannelRoute extends DiscourseRoute {
@service chat;
beforeModel() {
if (!this.chat.userCanDirectMessage) {
this.transitionTo("chat");
}
}
activate() {
this.chat.activeChannel = null;
}
}