mirror of
https://github.com/hanzoai/forum.git
synced 2026-09-30 21:51:19 +00:00
* DEV: rename chat preferred mobile index to chat preferred index * UX: change routing to be consistent with mobile * DEV: change migration file to use script * UX: show footer only if more than one option is available * UX: Remove desktopView only checks for chat * DEV: Remove unused imports * UX: Update chat footer checks and Add rerouting to chat drawer * UX: Add margin to chat row in desktop and update chat drawer logic * UX: Change chat in desktop to use flexbox * UX: Add drawer actions to chat navbar * DEV: Update page object with new chat css classes removed `.open-browse-page-btn` usage in 7bd65006d760886b261f0587fafe28443bf2d3ec * DEV: rename `browse/open` in chat url to `channels` * UX: Adjust css for when in threads mode * DEV: change css class name in no_sidebar_spec.rb * DEV: rename tests to be more descriptive with the action they are testing update chat template to not rely on `:has` * DEV: update test and add method to chat page object * DEV: update no_sidebar_spec for chat changes * DEV: remove tests from navigation_spec that no longer apply * DEV: revert typo in test * DEV: change url path for mobile chat in test specs * DEV: Add check for when is desktop in rerouting * UX: Removed footer from desktop. Made `hasThreads` and `hasDirectMessages` methods in chat-drawer public * UX: remove sidebar on desktop full page if dm list is empty * DEV: Address review comments * DEV: Adjust reroute logic for chat browse remove unused code * UX: Adjust rerouting to go to browse.open * UX: Change rerouting to be more consistent Add chat_default_channel_id routing * UX: Update rerouting configuration for chat routes * DEV: Update tests with the new chat behavior * DEV: revert changes made in tests and bring back toggle for drawer * DEV: revert classes in page objects * DEV: Add tests to new chat navigation behavior remove unused stylesheets revert deleted lines in tests update concat class logic in chat dm template * DEV: update css on test
58 lines
1.4 KiB
JavaScript
58 lines
1.4 KiB
JavaScript
import { service } from "@ember/service";
|
|
import DiscourseRoute from "discourse/routes/discourse";
|
|
|
|
export default class ChatIndexRoute extends DiscourseRoute {
|
|
@service chat;
|
|
@service chatChannelsManager;
|
|
@service router;
|
|
@service siteSettings;
|
|
@service currentUser;
|
|
|
|
get hasThreads() {
|
|
if (!this.siteSettings.chat_threads_enabled) {
|
|
return false;
|
|
}
|
|
|
|
return this.chatChannelsManager.hasThreadedChannels;
|
|
}
|
|
|
|
get hasDirectMessages() {
|
|
return this.chat.userCanAccessDirectMessages;
|
|
}
|
|
|
|
get isPublicChannelsEnabled() {
|
|
return this.siteSettings.enable_public_channels;
|
|
}
|
|
|
|
activate() {
|
|
this.chat.activeChannel = null;
|
|
}
|
|
|
|
async model() {
|
|
return await this.chat.loadChannels();
|
|
}
|
|
|
|
async redirect() {
|
|
if (
|
|
this.siteSettings.chat_preferred_index === "my_threads" &&
|
|
this.hasThreads
|
|
) {
|
|
return this.router.replaceWith("chat.threads");
|
|
} else if (
|
|
this.siteSettings.chat_preferred_index === "direct_messages" &&
|
|
this.hasDirectMessages
|
|
) {
|
|
return this.router.replaceWith("chat.direct-messages");
|
|
} else if (
|
|
this.siteSettings.chat_preferred_index === "channels" &&
|
|
this.isPublicChannelsEnabled
|
|
) {
|
|
return this.router.replaceWith("chat.channels");
|
|
}
|
|
if (!this.isPublicChannelsEnabled && this.hasDirectMessages) {
|
|
return this.router.replaceWith("chat.direct-messages");
|
|
}
|
|
return this.router.replaceWith("chat.browse.open");
|
|
}
|
|
}
|