[FIX] mail: discuss sidebar quick search case-insensitive
Before this commit, quick search in discuss sidebar (shown when more than 20 conversations) was case-sensitive. For example, when a channel was named "R&D" and user types "r", the channel was not found. This commit fixes the issue by making search case-insensitive. Task-3485254 opw-3445747 closes odoo/odoo#134603 X-original-commit: 02e5af467b6058ea0933255c8f0c4e8dab17f31d 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:
@@ -5,6 +5,7 @@ import { ThreadIcon } from "@mail/core/common/thread_icon";
|
||||
import { discussSidebarItemsRegistry } from "@mail/core/web/discuss_sidebar";
|
||||
import { ChannelSelector } from "@mail/discuss/core/web/channel_selector";
|
||||
import { onExternalClick } from "@mail/utils/common/hooks";
|
||||
import { cleanTerm } from "@mail/utils/common/format";
|
||||
|
||||
import { Component, useState } from "@odoo/owl";
|
||||
|
||||
@@ -84,7 +85,8 @@ export class DiscussSidebarCategories extends Component {
|
||||
const thread = this.store.Thread.records[threadLocalId];
|
||||
return (
|
||||
(thread.is_pinned || thread.group_based_subscription) &&
|
||||
(!this.state.quickSearchVal || thread.name.includes(this.state.quickSearchVal))
|
||||
(!this.state.quickSearchVal ||
|
||||
cleanTerm(thread.name).includes(cleanTerm(this.state.quickSearchVal)))
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -210,6 +210,12 @@ QUnit.test("sidebar quick search at 20 or more pinned channels", async () => {
|
||||
replace: true,
|
||||
});
|
||||
await contains(".o-mail-DiscussSidebarChannel span", { count: 0 });
|
||||
|
||||
// search should work in case-insensitive
|
||||
await insertText(".o-mail-DiscussSidebar input[placeholder='Quick search...']", "C", {
|
||||
replace: true,
|
||||
});
|
||||
await contains(".o-mail-DiscussSidebarChannel span", { count: 20 });
|
||||
});
|
||||
|
||||
QUnit.test("sidebar: basic chat rendering", async () => {
|
||||
|
||||
Reference in New Issue
Block a user