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.
This commit is contained in:
Pratik Chanda 2024-07-04 18:47:46 +05:30 committed by Tim Abbott
parent 601125e1ca
commit 897852f130
1 changed files with 2 additions and 2 deletions

View File

@ -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 "<strong>" + Handlebars.Utils.escapeExpression(item) + "</strong>";
return Handlebars.Utils.escapeExpression(item);
}
// We need to assemble this manually (as opposed to doing 'join') because we need to