diff --git a/addons/mail/static/src/web/chat_window/chat_window.js b/addons/mail/static/src/web/chat_window/chat_window.js index b46d6a8645c..700603c914e 100644 --- a/addons/mail/static/src/web/chat_window/chat_window.js +++ b/addons/mail/static/src/web/chat_window/chat_window.js @@ -80,11 +80,12 @@ export class ChatWindow extends Component { } get style() { + const maxHeight = !this.store.isSmall ? "max-height: 95vh;" : ""; const textDirection = localization.direction; const offsetFrom = textDirection === "rtl" ? "left" : "right"; const visibleOffset = this.store.isSmall ? 0 : this.props.right; const oppositeFrom = offsetFrom === "right" ? "left" : "right"; - return `${offsetFrom}: ${visibleOffset}px; ${oppositeFrom}: auto`; + return `${offsetFrom}: ${visibleOffset}px; ${oppositeFrom}: auto; ${maxHeight}`; } onKeydown(ev) { @@ -114,6 +115,9 @@ export class ChatWindow extends Component { } toggleFold() { + if (this.store.isSmall) { + return; + } if (this.props.chatWindow.hidden) { this.chatWindowService.makeVisible(this.props.chatWindow); } else { diff --git a/addons/mail/static/src/web/chat_window/chat_window.scss b/addons/mail/static/src/web/chat_window/chat_window.scss index 28848e090e3..988139f7aa6 100644 --- a/addons/mail/static/src/web/chat_window/chat_window.scss +++ b/addons/mail/static/src/web/chat_window/chat_window.scss @@ -1,5 +1,4 @@ .o-mail-ChatWindow { - max-height: 95vh; height: 460px; width: $o-mail-ChatWindow-width; z-index: 999; // messaging menu is dropdown (1000) diff --git a/addons/mail/static/src/web/chat_window/chat_window.xml b/addons/mail/static/src/web/chat_window/chat_window.xml index e0bf156852a..b95d95ff84a 100644 --- a/addons/mail/static/src/web/chat_window/chat_window.xml +++ b/addons/mail/static/src/web/chat_window/chat_window.xml @@ -7,12 +7,13 @@ t-att-class="{ 'w-100 h-100': store.isSmall, 'o-folded': props.chatWindow.folded, - 'position-absolute bottom-0 rounded-top-3 overflow-hidden d-flex flex-column': !props.chatWindow.hidden + 'position-absolute bottom-0 overflow-hidden d-flex flex-column': !props.chatWindow.hidden, + 'rounded-top-3': !props.chatWindow.hidden and !store.isSmall, }" t-on-keydown.stop="onKeydown" tabindex="1" > -
+
diff --git a/addons/mail/static/tests/chat_window/chat_window_tests.js b/addons/mail/static/tests/chat_window/chat_window_tests.js index 8d699d47c89..d71c566ce18 100644 --- a/addons/mail/static/tests/chat_window/chat_window_tests.js +++ b/addons/mail/static/tests/chat_window/chat_window_tests.js @@ -976,3 +976,18 @@ QUnit.test("folded chat window should hide member-list and settings buttons", as assert.containsOnce($, "div[title='Show Member List']"); assert.containsOnce($, "div[title='Show Call Settings']"); }); + +QUnit.test("Chat window in mobile are not foldable", async (assert) => { + const pyEnv = await startServer(); + pyEnv["mail.channel"].create({ + channel_member_ids: [[0, 0, { fold_state: "open", partner_id: pyEnv.currentPartnerId }]], + }); + patchUiSize({ size: SIZES.SM }); + await start(); + await click("button i[aria-label='Messages']"); + await click(".o-mail-NotificationItem"); + assert.containsNone($, ".o-mail-ChatWindow-header.cursor-pointer"); + click(".o-mail-ChatWindow-header").catch(() => {}); + await nextAnimationFrame(); + assert.containsOnce($, ".o-mail-ChatWindow-content"); // content => non-folded +});