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
emoji: Use some more informational source for generating mapping information. #3923
Conversation
Hello @zulip/server-emoji members, this pull request references an issue with the area: emoji label, so you may want to check it out! |
fa327cd
to
bbe4c59
Compare
Just took a quick look to get a feel for how you're doing this. Re; the iamcal data, I think we might want to implement a system where |
c0de089
to
3b4a929
Compare
@timabbott @rishig I have pushed here a working prototype to showcase what iamcal's emoji.json is offering to us. It's just a working prototype not for review. Can you have a look!? |
Cool, this seems pretty good; @rishig as our resident emoji expert, do you want to check it out as well? You need to provision, and it's only in the compose emoji picker (not reactions). I did notice a few things:
In
but @rishig may have thoughts on the long-term structure. |
For the picker, I just noticed https://github.com/needim/wdt-emoji-bundle, which uses the iamcal data set (just saw this linked). It could be worth seeing if integrating (or forking) that would be an easier path than making a nice picker ourselves from bootstrap popovers. If we decide we don't want to use that, I think it's reasonable for you to start working on a system for managing |
@timabbott The main problem with https://github.com/needim/wdt-emoji-bundle is that it currently has no support for custom emojis and also there are some glitches like text not showing while I type in the textbox etc. |
Yeah, OK, sounds like it may be buggy. But since it's MIT-licensed, we can probably borrow some of their CSS at least :) |
yeah, I think category -> list of unicode codepoints is probably good as a long term structure. We'll also need a category for zulip.png (the "unicode codepoint" there would be |
1c3ca55
to
bd13829
Compare
I am stuck on this PR from the past one and half week without much progress. With every change that I am making I am getting a feeling that our emoji system is getting more and more complex and fragile and maintaining it in the future will be a real pain. I think we need a more structured plan to fix our emoji system from the starting itself. @timabbott @rishig thoughts? |
Well, I think once we have everything working well off the iamcal emoji data sprite sheets, I think it should be possible to remove most of the older code, and thus simplify the system. The problem is that before doing that we'll need to migrate historical messages (or otherwise put in a backwards-compatibility system), but I think that should be manageable. But until we're ready to do that, the system will definitely increase in complexity for a while. |
What problems are you stuck on currently @HarshitOnGitHub? I can start reviewing and merging pieces if that'd be helpful. |
There is no specific problem as such but as I make some new change that change tends to break some other part of the code and due to the complexity it sometimes become really difficult to track if it's going to break something and most of the times it does and I need to add some kind of handcoded exceptional logic to fix it which I think will make it harder to make changes at a later stage. |
Yeah, that's life working with a complicated system that doesn't have tests :). I suspect we can mostly solve the long-term maintainability problem by writing tests for the places where we needed to hardcode an exception (e.g. Node tests that inspect I think the medium-term plan should be for new messages just use the iamcal data set (and not even use the old emoji-map.json) and actually just use their sprite sheets directly as well (I guess we'll have to move the zulip emoji back to an independent image), since then the only outputs we need to produce are |
Yeah, I think removing our sprite generation code is going to reduce a lot of complexity. |
I definitely remember feeling overwhelmed by the complexity of the emoji system when I was dealing with it. For backwards compatibility, is the symlink farm sufficient? Realm emoji are just external links anyway, right? |
symlink farm is sufficient for maintaining the backward compatibility as long as we can generate it without errors. We are using |
There may be a misunderstanding here. I think the proposal is to have two completely independent systems:
So there should be no interaction between the old names and the new names, and no symlinks should be generated from the iamcal data. Does that make sense? We can also move this to chat.zulip.com, just at-mention me there if you start a thread. |
The symlinks do not directly point to the png files extracted from the ttf file rather they to the png files in out/unicode which are essentially copies of png files extracted from the ttf files after being renamed using a mapping generated from NotoColorEmoji.ttx and iamcal's dataset and there are some codepoints on which either emoji_map and iamcal's dataset don't agree or they are not bound to any short name in iamcal's dataset. |
e92dc55
to
b22d3ce
Compare
@timabbott @rishig Since it was almost impossible to rebase the old branch I have redone this from scratch and this seems to be ready for a review. This apart from switching us to use sprite sheets also fixes a longstanding issue of number emojis being not searchable in emoji picker ever since we introduced emoji aliases. Also includes some fixes to notifications.py so that we don't break emoji rendering there. P.S.: The test suite that I had added for relative URLs in digest emails is working well. It prevented me from introducing a bug related to zulip emoji. |
content) | ||
content = content.replace(' class="emoji"', ' style="height: 20px;"') | ||
|
||
return content |
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.
Just a comment: I think we may want to eventually migrate this code path to use xml.ElementTree for doing the rewriting; that would likely be a lot more robust than the regular expressions we've been doing.
But it's not a regression, so OK for now :)
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.
Yeah I was also thinking of replacing these regex with lxml while writing code for replacing spans with img tags.
It's great that the "big commit" is only ~100LOC, much of it changes in tests. I just looked through it, and the first commit at least looks good. I'll plan to test-deploy to chat.zulip.org today. |
Haha, doing it took more than I had expected. Will it make sense to make a tool for automatically updating |
I've for a while wanted a pretty-printer at least for the diff when you get a failure in |
b22d3ce
to
cce5148
Compare
I thought the name change was only for new codepoints? I.e. if a codepoint has a name in the current system, it's keeping its name till a bigger naming overhaul that should happen in a couple of weeks. |
I had fixed it, may be forgot to push the new version, will push it now.
Oops will fix it.
Yeah I had realized later and added a separate commit to bump the provision version while fixing the typeahead coverage issue, will push now. Also there are no name changes in this PR. I have used the same names as we were using earlier. |
Another thing to think about it is notifications which we have already fixed. For emoji reactions we are already using the iamcal's version of |
Actually changing the |
cce5148
to
dd95a9c
Compare
This commit switches to use sprite sheets for rendering emojis in all the remaining places, i.e., message bodies and composebox typeahead. This commit also includes some changes to notifications.py file so that the spans used for rendering emojis can be converted to corresponding image tags so that we don't break the emoji rendering in missed message emails since we can't use sprite sheets there. Fixes: zulip#3972.
This hack was used to fix the broken flag emojis in emoji-picker. It was broken due to the incomplete migration to iamcal dataset. See issue zulip#4775 for more details.
…tly. This hack was used to fix the broken number emojis in the emoji picker. It was broken because of the partial migration to the iamcal dataset. See issue zulip#4775 for more details.
This commit removes some unused data structures: `emojis_by_unicode` and `default_unicode_emojis` to be particular.
This list contained a list of codepoints of all the emojis. We now have `codepoint_to_name` in emoji_codes.js and hence this is not required.
dd95a9c
to
6b6e9d4
Compare
Merged, thanks @HarshitOnGitHub! This has been one of the more epic projects in Zulip; huge thanks for all your work to make this happen! |
Fixes: #3972.