Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

typeahead: Remove diacritics only for valid queries.

apoorvapendse1bcf05b13db5
diff --git a/web/shared/src/typeahead.ts b/web/shared/src/typeahead.ts
index a299463b519..5c94a4b804f 100644
--- a/web/shared/src/typeahead.ts
+++ b/web/shared/src/typeahead.ts
@@ -95,11 +95,13 @@ export function query_matches_string_in_order(
source_str: string,
split_char: string,
): boolean {
+ query = query.toLowerCase();
source_str = source_str.toLowerCase();
- source_str = remove_diacritics(source_str);
- query = query.toLowerCase();
- query = remove_diacritics(query);
+ const should_remove_diacritics = /^[a-z]+$/.test(query);
+ if (should_remove_diacritics) {
+ source_str = remove_diacritics(source_str);
+ }
return query_matches_string_in_order_assume_canonicalized(query, source_str, split_char);
}