trakt / api-help

Trakt API docs at https://trakt.docs.apiary.io
183 stars 7 forks source link

Emoji support clarification for comments #40

Closed kevincador closed 5 years ago

kevincador commented 5 years ago

Hey,

I’d like to understand where we stand from an emoji standpoint with comments. A lot of people would love to use them in their comments.

Over the years, when posting a comment with an emoji, it produced an error. Today it seems like the emojis posted with the comment API are striped out of the comment. But I see more and more emojis appearing in some comments.

Could it please be clarified in the documentation? What is supported? When posting (how)? When getting (rendering)?

Thanks!

rectifyer commented 5 years ago

Behind the scenes, the database can't store the correct character set for emojis so we strip them out if people use them. Some comments might use unicode "emjois" which would work since they are in the standard character set. Supporting the emoji character set would require a substantial database change behind the scenes which is why we haven't done it.

I've also looked into using a service like https://www.emojione.com to translate strings like :grinning: into πŸ˜€ which is how TMDB handles emojis. This of course would mean we just store and return the strings like :grinning: and it would be up to the apps to replace them with the correct emojis. Any thoughts on that?

jemus42 commented 5 years ago

Using shortcodes would be my preferred option – you can memorize shortcodes, they're used on tons of other services already so people are used to them, and they don't cause any multibyte-character-weirdness (assuming your DB incompatibility is something like that, and I don't even want to think about having to deal with potential weirdness via the API, in case I every decide to run text-analysis on comments or something).

rectifyer commented 5 years ago

Yeah, that was my thinking with shortcodes too. It is more compatible for us to store and also good for API apps since it is just text based. I'm going to look into emojione and see if that will work well for us.

kevincador commented 5 years ago

I'm going to use this as a reference. I'll encode the emojis when posting a comment so they are sent your way as :emoji_code: and I'll decode every comment coming from the trakt API to replace :grinning: by πŸ˜€

When you do support it, you should ask to be in that list too πŸ˜„

rectifyer commented 5 years ago

Awesome sounds great. I'm working on implementing Emoji One right now and I should have it on staging later today to test out.

rectifyer commented 5 years ago

Staging is updated and now supports emojis! The API and web are both updated to save and display (web only obviously) the emoji short codes. We are using the emoji one library.

The API and web will both accept β€œreal” emojis too and auto convert them to the short codes. This makes it way more useful from mobile devices.

Please test out in staging and let me know if you run into any issues! I still have more testing to do and need to fix stuff in web like the styling and dark mode specifically.

kevincador commented 5 years ago

Awesome! Thanks a lot. Working really good. Minimal effort my side to support both ways πŸ‘Œ

rectifyer commented 5 years ago

Emoji support is now live on the Trakt website and API. Docs updated at https://trakt.docs.apiary.io/#reference/comments with some more info about how we use short codes to store the emojis. One the website, we use the EmojiOne library to render them.