mirror of
https://github.com/hanzoai/forum.git
synced 2026-09-30 21:51:19 +00:00
* 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
30 lines
738 B
JavaScript
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;
|
|
}
|
|
}
|