[FIX] mail: make getRecentChannels order deterministic
Fallback to ID compare when the dates are the same. Added some extra steps in the test to help further debugging if this PR does not completely resolve the issue. runbot-28637 Part-of: odoo/odoo#144580
This commit is contained in:
@@ -235,16 +235,16 @@ patch(ThreadService.prototype, {
|
||||
return Object.values(this.store.Thread.records)
|
||||
.filter((thread) => thread.model === "discuss.channel")
|
||||
.sort((a, b) => {
|
||||
if (!a.lastInterestDateTime && !b.lastInterestDateTime) {
|
||||
return 0;
|
||||
if (a.lastInterestDateTime?.ts !== b.lastInterestDateTime?.ts) {
|
||||
if (!b.lastInterestDateTime) {
|
||||
return -1;
|
||||
}
|
||||
if (!a.lastInterestDateTime) {
|
||||
return 1;
|
||||
}
|
||||
return b.lastInterestDateTime.ts - a.lastInterestDateTime.ts;
|
||||
}
|
||||
if (a.lastInterestDateTime && !b.lastInterestDateTime) {
|
||||
return -1;
|
||||
}
|
||||
if (!a.lastInterestDateTime && b.lastInterestDateTime) {
|
||||
return 1;
|
||||
}
|
||||
return b.lastInterestDateTime.ts - a.lastInterestDateTime.ts;
|
||||
return a.id - b.id;
|
||||
});
|
||||
},
|
||||
getNeedactionChannels() {
|
||||
|
||||
@@ -43,6 +43,8 @@ QUnit.test("open the chatWindow of a channel from the command palette", async ()
|
||||
await insertText(".o_command_palette_search input", "#");
|
||||
advanceTime(commandSetupRegistry.get("#").debounceDelay);
|
||||
await contains(".o_command", { count: 2 });
|
||||
await contains(".o_command", { text: "general", before: [".o_command", { text: "project" }] });
|
||||
await contains(".o_command.focused");
|
||||
await click(".o_command.focused", { text: "general" });
|
||||
await contains(".o-mail-ChatWindow", { text: "general" });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user