Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
typeahead: Create new EmojiSuggestion type.
evykassirerbccdec897155
diff --git a/web/shared/src/typeahead.ts b/web/shared/src/typeahead.tsindex 53d5ecf962a..9d18be37aa5 100644--- a/web/shared/src/typeahead.ts+++ b/web/shared/src/typeahead.ts@@ -35,6 +35,8 @@ type Emoji =emoji_name: string;reaction_type: "realm_emoji" | "zulip_extra_emoji";is_realm_emoji: true;+ emoji_url?: string | undefined;+ emoji_code?: undefined;}| UnicodeEmoji;@@ -44,6 +46,10 @@ type UnicodeEmoji = {emoji_code: string;reaction_type: "unicode_emoji";is_realm_emoji: false;+ emoji_url?: string | undefined;+};+export type EmojiSuggestion = Emoji & {+ type: "emoji";};export function remove_diacritics(s: string): string {@@ -193,7 +199,7 @@ export const parse_unicode_emoji_code = (code: string): string =>.map((hex) => String.fromCodePoint(Number.parseInt(hex, 16))).join("");-export function get_emoji_matcher(query: string): (emoji: Emoji) => boolean {+export function get_emoji_matcher(query: string): (emoji: EmojiSuggestion) => boolean {// replace spaces with underscores for emoji matchingquery = query.replace(/ /g, "_");query = clean_query_lowercase(query);@@ -308,7 +314,7 @@ export function triage<T>(};}-export function sort_emojis<T extends Emoji>(objs: T[], query: string): T[] {+export function sort_emojis<T extends EmojiSuggestion>(objs: T[], query: string): T[] {// replace spaces with underscores for emoji matchingquery = query.replace(/ /g, "_");query = query.toLowerCase();@@ -320,7 +326,7 @@ export function sort_emojis<T extends Emoji>(objs: T[], query: string): T[] {const popular_set = new Set(popular_emojis);- function is_popular(obj: Emoji): boolean {+ function is_popular(obj: EmojiSuggestion): boolean {return (obj.reaction_type === "unicode_emoji" &&popular_set.has(obj.emoji_code) &&