From 1fe66a238f3eea8e13d2f4c99308d63639323f0b Mon Sep 17 00:00:00 2001 From: Evy Kassirer Date: Thu, 11 Apr 2024 15:36:20 -0700 Subject: [PATCH] build_emoji: Make sure emoji names are supported. Fixes #19398. (All the other parts were completed a while ago). --- tools/setup/emoji/build_emoji | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/setup/emoji/build_emoji b/tools/setup/emoji/build_emoji index b04ba8c9d8..232aee8dd6 100755 --- a/tools/setup/emoji/build_emoji +++ b/tools/setup/emoji/build_emoji @@ -423,6 +423,17 @@ def dump_emojis(cache_path: str) -> None: EMOJI_DATA_FILE_PATH = os.path.join(NODE_MODULES_PATH, "emoji-datasource-google", "emoji.json") with open(EMOJI_DATA_FILE_PATH, "rb") as emoji_data_file: emoji_data = orjson.loads(emoji_data_file.read()) + + # These are the codes that we'll be able to show Google Modern + # emoji for. (For other emoji sets, we fall back to Google Modern.) + supported_codes = {get_emoji_code(emoji) for emoji in emoji_data if emoji_is_supported(emoji)} + # These are in the emoji dropdown so we should make sure they're supported. + for code in EMOJI_NAME_MAPS: + # If an assertion here fails, we either need to find an image for Google Modern + # to display for that emoji, or we need to remove that emoji as an option for users, + # by removing it from emoji_names.py through a change to `generate_emoji_names`. + assert code in supported_codes + emoji_catalog = generate_emoji_catalog(emoji_data, EMOJI_NAME_MAPS) # Set up emoji farms.