From 70b165a1db53e91034ce095273b52542d08a84fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Thu, 16 Mar 2023 13:28:20 +0000 Subject: [PATCH] [FIX] mail: open call settings then select mailbox should not crash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce: - open Discuss app with "General" as active thread - open call settings in the inspector - open a mailbox as active thread Crash: ``` Cannot read showOnlyVideo of undefined ``` This happens because discuss has a single thread view that is shared for any selected thread. However, the call settings menu only makes sense for thread that have call feature, which applies for only channels. Mailboxes should not have any call settings menu. closes odoo/odoo#115769 X-original-commit: 6e98ed068f01903383aca3348c193b56b46c6f95 Signed-off-by: Sébastien Theys (seb) Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/discuss/discuss.xml | 4 +-- .../tests/call/call_settings_menu_tests.js | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/addons/mail/static/src/discuss/discuss.xml b/addons/mail/static/src/discuss/discuss.xml index 038d1846089..78e60b094a4 100644 --- a/addons/mail/static/src/discuss/discuss.xml +++ b/addons/mail/static/src/discuss/discuss.xml @@ -37,7 +37,7 @@ -
@@ -61,7 +61,7 @@
- +
diff --git a/addons/mail/static/tests/call/call_settings_menu_tests.js b/addons/mail/static/tests/call/call_settings_menu_tests.js index ac5faeb2235..2ee02303d45 100644 --- a/addons/mail/static/tests/call/call_settings_menu_tests.js +++ b/addons/mail/static/tests/call/call_settings_menu_tests.js @@ -80,3 +80,32 @@ QUnit.test("activate blur", async (assert) => { assert.containsOnce($, "label[aria-label='Background blur intensity']"); assert.containsOnce($, "label[aria-label='Edge blur intensity']"); }); + +QUnit.test("Inbox should not have any call settings menu", async (assert) => { + await startServer(); + const { openDiscuss } = await start(); + await openDiscuss("mail.box_inbox"); + assert.containsNone($, "button[title='Show Call Settings']"); +}); + +QUnit.test( + "Call settings menu should not be visible on selecting a mailbox (from being open)", + async (assert) => { + patchWithCleanup(browser, { + navigator: { + ...browser.navigator, + mediaDevices: { + enumerateDevices: () => Promise.resolve([]), + }, + }, + }); + const pyEnv = await startServer(); + const channelId = pyEnv["mail.channel"].create({ name: "General" }); + const { openDiscuss } = await start(); + await openDiscuss(channelId); + await click("button[title='Show Call Settings']"); + await click("button:contains(Inbox)"); + assert.containsNone($, "button[title='Hide Call Settings']"); + assert.containsNone($, ".o-mail-CallSettings"); + } +);