Emojis
GitLab supports native Emojis through the tanuki_emoji
gem.
How to update Emojis
Because our emoji support is implemented on both the backend and the frontend, we need to update support over three milestones.
First milestone (backend)
- Update the
tanuki_emoji
gem as needed. - Update the
Gemfile
to use the latesttanuki_emoji
gem. - Update the
Gemfile
to use the latestunicode-emoji
that supports the version of Unicode you’re upgrading to. - Update
EMOJI_VERSION
inlib/gitlab/emoji.rb
bundle exec rake tanuki_emoji:import
- imports all fallback images into the versionedpublic/-/emojis
directory. Ensure you see new individual images copied into there.- When testing, you should be able to use the shortcodes of any new emojis and have them display.
- See example MRs one and two for the backend.
Second milestone (frontend)
- Update
EMOJI_VERSION
inapp/assets/javascripts/emoji/index.js
- Use the
tanuki_emoji
gem’s Rake tasks to update aliases, digests, and sprites. Run in the following order:bundle exec rake tanuki_emoji:aliases
- updatesfixtures/emojis/aliases.json
bundle exec rake tanuki_emoji:digests
- updatespublic/-/emojis/VERSION/emojis.json
andfixtures/emojis/digests.json
bundle exec rake tanuki_emoji:sprite
- creates new sprite sheetsIf new emoji are added, the sprite sheet may change size. To compensate for such changes, first generate the
app/assets/images/emoji.png
sprite sheet with the above Rake task, then check the dimensions of the new sprite sheet and update theSPRITESHEET_WIDTH
andSPRITESHEET_HEIGHT
constants inlib/tasks/tanuki_emoji.rake
accordingly. Then re-run the task.- Use ImageOptim or similar program to optimize the images for size
- Ensure new sprite sheets were generated for 1x and 2x
app/assets/images/emoji.png
app/assets/images/emoji@2x.png
- Update
fixtures/emojis/intents.json
with any new emoji that we would like to highlight as having positive or negative intent.- Positive intent should be set to
0.5
. - Neutral intent can be set to
1
. This is applied to all emoji automatically so there is no need to set this explicitly. - Negative intent should be set to
1.5
.
- Positive intent should be set to
- You might need to add new emoji Unicode support checks and rules for platforms
that do not support a certain emoji and we need to fallback to an image.
See
app/assets/javascripts/emoji/support/is_emoji_unicode_supported.js
andapp/assets/javascripts/emoji/support/unicode_support_map.js
- Ensure you use the version of emoji-regex that corresponds
to the version of Unicode that is being supported. This should be updated in
package.json
. Used for filtering emojis inapp/assets/javascripts/emoji/index.js
. - Have there been any changes to the category names? If so then
app/assets/javascripts/emoji/constants.js
will need to be updated - When testing
- Ensure you can see the new emojis and their aliases in the GitLab Flavored Markdown (GLFM) Autocomplete
- Ensure you can see the new emojis and their aliases in the emoji reactions menu
Third milestone (cleanup)
Remove any old emoji versions from the public/-/emojis
directory. This is not strictly necessary -
everything continues to work if you don’t do this. However it’s good to clean it up.
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support