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.

Revert "shared: Match literal emoji in typeahead."

Austin Riba12c563cc9402
diff --git a/frontend_tests/node_tests/typeahead.js b/frontend_tests/node_tests/typeahead.js
index 13c66ddf69f..aa2163279ff 100644
--- a/frontend_tests/node_tests/typeahead.js
+++ b/frontend_tests/node_tests/typeahead.js
@@ -52,13 +52,6 @@ run_test("get_emoji_matcher", () => {
assert_matches("japanese_post_", [emoji_japanese_post_office]);
assert_matches("japanese post ", [emoji_japanese_post_office]);
-
- assert_matches("🐼", [emoji_panda_face]);
-});
-
-run_test("parse_unicode_emoji_code", () => {
- assert.equal(typeahead.parse_unicode_emoji_code("1f43c"), "🐼");
- assert.equal(typeahead.parse_unicode_emoji_code("not_unicode"), undefined);
});
run_test("triage", () => {
diff --git a/static/shared/js/typeahead.js b/static/shared/js/typeahead.js
index 9d11c94ad5b..361f313882b 100644
--- a/static/shared/js/typeahead.js
+++ b/static/shared/js/typeahead.js
@@ -98,30 +98,13 @@ export function clean_query_lowercase(query) {
return query;
}
-export const parse_unicode_emoji_code = (code) => {
- try {
- return code
- .split("-")
- .map((hex) => String.fromCodePoint(Number.parseInt(hex, 16)))
- .join("");
- } catch {
- // Code could not be parsed, but instead of throwing an exception
- // we return undefined instead of a string.
- return undefined;
- }
-};
-
export function get_emoji_matcher(query) {
// replaces spaces with underscores for emoji matching
query = query.replace(/ /g, "_");
query = clean_query_lowercase(query);
return function (emoji) {
- const matches_emoji_literal =
- emoji.emoji_code && parse_unicode_emoji_code(emoji.emoji_code) === query;
- return (
- matches_emoji_literal || query_matches_source_attrs(query, emoji, ["emoji_name"], "_")
- );
+ return query_matches_source_attrs(query, emoji, ["emoji_name"], "_");
};
}