discourse/plugins/chat/assets/javascripts/discourse/lib/get-user-chat-separate-sidebar-mode.js
Joffrey JAFFEUX b03c26ebf5
FIX: correctly handles mobile and default (#23152)
This commit ensures we have correct icon and title on mobile for the chat header icon.

It also fixes a bug where the site setting was not correctly used when the user has not yet set the user option.

Both cases are now correctly tested.
2023-08-18 22:32:43 +02:00

13 lines
328 B
JavaScript

export function getUserChatSeparateSidebarMode(user) {
let mode = user?.get("user_option.chat_separate_sidebar_mode");
if (mode === "default") {
mode = user.siteSettings.chat_separate_sidebar_mode;
}
return {
never: "never" === mode,
always: "always" === mode,
fullscreen: "fullscreen" === mode,
};
}