[FIX] mail: fold discuss app category when no conversation selected

Before this commit, when no conversation was selected in the
Discuss app, folding a category such as "Channels" results in
a crash.

This happens because `store.discuss.thread` is `undefined`, so it
must be properly guarded in the template of discuss sidebar category.

closes odoo/odoo#150828

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
Alexandre Kühn
2024-01-24 12:30:09 +00:00
committed by Sébastien Theys
parent 25fe8cfbae
commit 17a3a84aaa
2 changed files with 4 additions and 1 deletions
@@ -34,7 +34,7 @@
<t t-set="thread" t-value="thread"/>
</t>
</t>
<t t-elif="store.discuss.thread.in(category.threads)" t-call="mail.DiscussSidebarChannel">
<t t-elif="store.discuss.thread?.in(category.threads)" t-call="mail.DiscussSidebarChannel">
<t t-set="thread" t-value="store.discuss.thread"/>
</t>
</t>
@@ -199,4 +199,7 @@ QUnit.test("no conversation selected when opening non-existing channel in discus
const { openDiscuss } = await start();
await openDiscuss(200); // non-existing id
await contains("h4", { text: "No conversation selected." });
await contains(".o-mail-DiscussSidebarCategory-channel .oi-chevron-down");
await click(".o-mail-DiscussSidebar .btn", { text: "Channels" }); // check no crash
await contains(".o-mail-DiscussSidebarCategory-channel .oi-chevron-right");
});