-
-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
model: Fetch emoji using events #825
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mkp6781 Thanks for starting to put together the ideas from the issues - it's clearer to see what you have here and give feedback 👍
This shows you have the scaffold for this, but note that the realm_emoji data you're adding is in a different format to that previously - that's at least one reason why you have so many test failures.
Note that if you update the fetch_custom_emojis and the associated locations and tests, then this will likely make adapting the tests easier.
I'm not sure why the tests aren't running yet 😕
zulipterminal/model.py
Outdated
Handle update of emoji | ||
""" | ||
realm_emojis = event['realm_emoji'] | ||
self.active_emoji_data.update(realm_emojis) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned previously, events are not in the same format as the original data, so a dict update is not feasible here.
zulipterminal/model.py
Outdated
@@ -145,7 +148,7 @@ def __init__(self, controller: Any) -> None: | |||
for name, data in unicode_emoji_data.items(): | |||
data['type'] = 'unicode_emoji' | |||
typed_unicode_emoji_data = cast(NamedEmojiData, unicode_emoji_data) | |||
custom_emoji_data = self.fetch_custom_emojis() | |||
custom_emoji_data = self.initial_data['realm_emoji'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sets custom_emoji_data
to a different data format than before; note the processing done in fetch_custom_emojis
- we could rename and adjust that to process the realm emoji in the initial data instead.
In principle we could adjust the code to handle original and emoji events to be in the same format, but we still need to integrate those with the format of the active_emoji_data
upon update.
Opened a pull request from my branch |
Fetching emoji using events ensures that emoji updates are not missed.
Initial state of emoji is updated from initial_data.