[FIX] mail: open call settings then select mailbox should not crash
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) <seb@odoo.com> Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
<button t-if="thread.hasMemberList" class="btn" t-att-title="state.activeMode === MODES.MEMBER_LIST ? 'Hide Member List' : 'Show Member List'" t-on-click.stop="toggleMemberList">
|
||||
<i class="fa fa-lg fa-users text-700"/>
|
||||
</button>
|
||||
<button t-if="thread.type !== 'mailbox'" class="btn" t-ref="settings" title="Show Call Settings" t-on-click="toggleSettings">
|
||||
<button t-if="thread.allowCalls" class="btn" t-ref="settings" t-att-title="state.activeMode === MODES.SETTINGS ? 'Hide Call Settings' : 'Show Call Settings'" t-on-click="toggleSettings">
|
||||
<i class="fa fa-lg fa-gear text-700"/>
|
||||
</button>
|
||||
<div t-if="props.public and !store.isSmall" class="d-flex align-items-center">
|
||||
@@ -61,7 +61,7 @@
|
||||
<Composer t-if="thread.type !== 'mailbox' or messageToReplyTo.thread === thread" t-key="thread.localId" composer="thread.composer" autofocus="true" messageEdition="messageEdition" messageToReplyTo="messageToReplyTo" highlightReplyTo="messageHighlight.highlightMessage" onDiscardCallback="() => messageToReplyTo.cancel()" dropzoneRef="contentRef"/>
|
||||
</div>
|
||||
<ChannelMemberList t-if="thread.hasMemberList and state.activeMode === MODES.MEMBER_LIST" thread="thread" className="'o-mail-Discuss-channelMemberList flex-shrink-0 border-start'"/>
|
||||
<CallSettings t-if="state.activeMode === MODES.SETTINGS and thread" thread="thread" className="'o-mail-Discuss-callSettings border-start'"/>
|
||||
<CallSettings t-if="thread.allowCalls and state.activeMode === MODES.SETTINGS" thread="thread" className="'o-mail-Discuss-callSettings border-start'"/>
|
||||
</div>
|
||||
</div>
|
||||
<div t-if="!thread and (!store.isSmall or store.discuss.activeTab === 'mailbox')" class="d-flex flex-grow-1 align-items-center justify-content-center w-100 bg-view">
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user