Skip to content
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

Closed
wants to merge 0 commits into from
Closed

Conversation

mkp6781
Copy link
Contributor

@mkp6781 mkp6781 commented Nov 14, 2020

Fetching emoji using events ensures that emoji updates are not missed.
Initial state of emoji is updated from initial_data.

Copy link
Collaborator

@neiljp neiljp left a 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 😕

Handle update of emoji
"""
realm_emojis = event['realm_emoji']
self.active_emoji_data.update(realm_emojis)
Copy link
Collaborator

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.

@@ -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']
Copy link
Collaborator

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.

@neiljp neiljp added the enhancement New feature or request label Nov 14, 2020
@mkp6781 mkp6781 closed this Nov 16, 2020
@mkp6781
Copy link
Contributor Author

mkp6781 commented Nov 16, 2020

Opened a pull request from my branch issue_809.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants