Merge pull request #3147 from oogm/develop

Update import_emojis.py to retain keyword order
This commit is contained in:
Benoit Marty 2021-04-09 10:00:47 +02:00 committed by GitHub
commit 0d9990b2e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -28,6 +28,7 @@ Bugfix 🐛:
- Fix avatar rendering for DMs, after initial sync (#2693) - Fix avatar rendering for DMs, after initial sync (#2693)
- Fix mandatory parameter in API (#3065) - Fix mandatory parameter in API (#3065)
- If signout request fails, do not start LoginActivity, but restart the app (#3099) - If signout request fails, do not start LoginActivity, but restart the app (#3099)
- Retain keyword order in emoji import script (#3147)
Translations 🗣: Translations 🗣:
- -

View File

@ -114,11 +114,13 @@ for emoji in emoji_picker_datasource_emojis:
# If additional keywords exist, add them to emoji_picker_datasource_emojis # If additional keywords exist, add them to emoji_picker_datasource_emojis
# Avoid duplicates and keep order. Put official unicode.com keywords first and extend up with emojilib ones. # Avoid duplicates and keep order. Put official unicode.com keywords first and extend up with emojilib ones.
new_keywords = OrderedDict.fromkeys(emoji_picker_datasource_emojis[emoji]["j"] + emoji_additional_keywords).keys() new_keywords = OrderedDict.fromkeys(emoji_picker_datasource_emojis[emoji]["j"] + emoji_additional_keywords)
# Remove the ones derived from the unicode name # Remove the ones derived from the unicode name
new_keywords = new_keywords - {emoji.replace("-", "_")} - {emoji.replace("-", " ")} - {emoji_name} for keyword in [emoji.replace("-", "_")] + [emoji.replace("-", " ")] + [emoji_name]:
if keyword in new_keywords:
new_keywords.pop(keyword)
# Write new keywords back # Write new keywords back
emoji_picker_datasource_emojis[emoji]["j"] = list(new_keywords) emoji_picker_datasource_emojis[emoji]["j"] = list(new_keywords.keys())
# Filter out components from unicode 13.1 (as they are not suitable for single-emoji reactions) # Filter out components from unicode 13.1 (as they are not suitable for single-emoji reactions)
emoji_picker_datasource['categories'] = [x for x in emoji_picker_datasource['categories'] if x['id'] != 'component'] emoji_picker_datasource['categories'] = [x for x in emoji_picker_datasource['categories'] if x['id'] != 'component']