From 0a6249744522c172bbbb3b73f2fe57d5d2f85e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Fri, 1 Dec 2023 19:54:31 +0100 Subject: [PATCH] [FIX] mail: make deterministic "open the chatWindow of a channel..." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Very rarely the "project" channel would be created in a different second than the general "channel", which lead to last interest taking priority over id when sorting them and unexpectedly putting project first. runbot-28637 closes odoo/odoo#144580 Signed-off-by: Alexandre Kühn (aku) --- .../discuss/core/web/command_palette_tests.js | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/addons/mail/static/tests/discuss/core/web/command_palette_tests.js b/addons/mail/static/tests/discuss/core/web/command_palette_tests.js index a1a490d61fa..1134db922e9 100644 --- a/addons/mail/static/tests/discuss/core/web/command_palette_tests.js +++ b/addons/mail/static/tests/discuss/core/web/command_palette_tests.js @@ -36,8 +36,24 @@ QUnit.test("open the chatWindow of a user from the command palette", async () => QUnit.test("open the chatWindow of a channel from the command palette", async () => { const pyEnv = await startServer(); - pyEnv["discuss.channel"].create({ name: "general" }); - pyEnv["discuss.channel"].create({ name: "project" }); + pyEnv["discuss.channel"].create({ + name: "general", + channel_member_ids: [ + Command.create({ + partner_id: pyEnv.currentPartnerId, + last_interest_dt: "2021-01-02 10:00:00", // same last interest to sort by id + }), + ], + }); + pyEnv["discuss.channel"].create({ + name: "project", + channel_member_ids: [ + Command.create({ + partner_id: pyEnv.currentPartnerId, + last_interest_dt: "2021-01-02 10:00:00", // same last interest to sort by id + }), + ], + }); const { advanceTime } = await start({ hasTimeControl: true }); triggerHotkey("control+k"); await insertText(".o_command_palette_search input", "#");