From 897852f1301250fddcbba4777ddc8d0fcd7570ee Mon Sep 17 00:00:00 2001 From: Pratik Chanda Date: Thu, 4 Jul 2024 18:47:46 +0530 Subject: [PATCH] typeahead: Remove highlight for suggestions with empty query. Earlier in typeaheads, empty query suggestions would highlight all the available suggestions for person name and channel name. This commit changes the behaviour so that empty query doesn't give highlighted suggestions. --- web/src/typeahead_helper.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/typeahead_helper.ts b/web/src/typeahead_helper.ts index 86fad92420..cd78c6f8c0 100644 --- a/web/src/typeahead_helper.ts +++ b/web/src/typeahead_helper.ts @@ -43,9 +43,9 @@ export function build_highlight_regex(query: string): RegExp { } export function highlight_with_escaping_and_regex(regex: RegExp, item: string): string { - // if regex is empty return entire item highlighted and escaped + // if regex is empty return entire item escaped if (regex.source === "()") { - return "" + Handlebars.Utils.escapeExpression(item) + ""; + return Handlebars.Utils.escapeExpression(item); } // We need to assemble this manually (as opposed to doing 'join') because we need to