Files
Gabriel GrubbaandGitHub 55fe8e78ec FIX: Remove chat default channel setting (#28170)
* FIX: Remove chat default channel being applied to mobile chat and drawer

* DEV: removing chat_default_channel_id setting

* DEV: add migration to remove chat default channel id

* DEV: remove default_channel_validator and tests
2024-07-31 14:12:10 -03:00

30 lines
738 B
JavaScript

import { service } from "@ember/service";
import DiscourseRoute from "discourse/routes/discourse";
export default class ChatChannelsRoute extends DiscourseRoute {
@service chat;
@service chatChannelsManager;
@service siteSettings;
activate() {
this.chat.activeChannel = null;
}
beforeModel() {
const id = this.currentUser.custom_fields.last_chat_channel_id;
if (this.site.desktopView) {
if (id) {
this.chatChannelsManager.find(id).then((c) => {
return this.router.replaceWith("chat.channel", ...c.routeModels);
});
} else {
this.router.replaceWith("chat.browse.open");
}
}
}
model() {
return this.chatChannelsManager.publicMessageChannels;
}
}