diff --git a/addons/mail/static/src/core/common/chat_window.scss b/addons/mail/static/src/core/common/chat_window.scss
index cccb2eb74ab..d1fcdec3d74 100644
--- a/addons/mail/static/src/core/common/chat_window.scss
+++ b/addons/mail/static/src/core/common/chat_window.scss
@@ -2,6 +2,9 @@
height: 480px;
width: $o-mail-ChatWindow-width;
z-index: 999; // messaging menu is dropdown (1000)
+ &.o-mobile {
+ z-index: 1001; // above messaging menu (chat window takes whole screen)
+ }
box-shadow: -5px -5px 10px rgba(#000000, 0.09);
outline: none;
diff --git a/addons/mail/static/src/core/common/chat_window.xml b/addons/mail/static/src/core/common/chat_window.xml
index 24859b7a496..792da3b6f90 100644
--- a/addons/mail/static/src/core/common/chat_window.xml
+++ b/addons/mail/static/src/core/common/chat_window.xml
@@ -5,7 +5,7 @@
+
diff --git a/addons/mail/static/src/core/web/messaging_menu.xml b/addons/mail/static/src/core/web/messaging_menu.xml
index 22d59c16b82..15f02d4605d 100644
--- a/addons/mail/static/src/core/web/messaging_menu.xml
+++ b/addons/mail/static/src/core/web/messaging_menu.xml
@@ -2,7 +2,7 @@
-
+
diff --git a/addons/mail/static/src/core/web/messaging_service_patch.js b/addons/mail/static/src/core/web/messaging_service_patch.js
index 79abc7c57fc..9025f0d1b66 100644
--- a/addons/mail/static/src/core/web/messaging_service_patch.js
+++ b/addons/mail/static/src/core/web/messaging_service_patch.js
@@ -23,7 +23,7 @@ patch(Messaging.prototype, "mail/core/web", {
);
this.notificationService.add(notification, { type: "info" });
const chat = await this.threadService.getChat({ partnerId });
- if (chat) {
+ if (chat && !this.ui.isSmall) {
this.chatWindowService.insert({ thread: chat });
}
});
@@ -32,7 +32,7 @@ patch(Messaging.prototype, "mail/core/web", {
this.loadFailures();
for (const channelData of data.channels) {
const thread = this.threadService.createChannelThread(channelData);
- if (channelData.is_minimized && channelData.state !== "closed") {
+ if (channelData.is_minimized && channelData.state !== "closed" && !this.ui.isSmall) {
this.chatWindowService.insert({
autofocus: 0,
folded: channelData.state === "folded",
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 75e85c41fd8..67bbac9bd13 100644
--- a/addons/mail/static/tests/chat_window/chat_window_tests.js
+++ b/addons/mail/static/tests/chat_window/chat_window_tests.js
@@ -1007,6 +1007,35 @@ QUnit.test("Chat window in mobile are not foldable", async (assert) => {
assert.containsOnce($, ".o-mail-ChatWindow-content"); // content => non-folded
});
+QUnit.test("Server-synced chat windows should not open at page load on mobile", async (assert) => {
+ const pyEnv = await startServer();
+ pyEnv["discuss.channel"].create({
+ channel_member_ids: [
+ Command.create({
+ fold_state: "open",
+ is_minimized: true,
+ partner_id: pyEnv.currentPartnerId,
+ }),
+ ],
+ });
+ patchUiSize({ size: SIZES.SM });
+ await start();
+ assert.containsNone($, ".o-mail-ChatWindow");
+});
+
+QUnit.test("chat window of channels should not have 'Open in Discuss' (mobile)", async (assert) => {
+ const pyEnv = await startServer();
+ pyEnv["discuss.channel"].create({ name: "General" });
+ patchUiSize({ size: SIZES.SM });
+ await start();
+ await click(".o_menu_systray i[aria-label='Messages']");
+ await click(".o-mail-NotificationItem");
+ assert.containsOnce($, ".o-mail-ChatWindow");
+ assert.containsOnce($, "[title='Open Actions Menu']");
+ await click("[title='Open Actions Menu']");
+ assert.containsNone($, "[title='Open in Discuss']");
+});
+
QUnit.test("Open chat window of new inviter", async (assert) => {
const pyEnv = await startServer();
await start();