Add a skin tone mapping fixture for emoji

What does this MR do and why?

Adds Gitlab::Emoji::SkinTones, which works out from the TanukiEmoji index which emoji is a skin tone variant of which base emoji, and a rake task tanuki_emoji:skin_tones that writes the result to fixtures/emojis/skin_tones.json.

Nothing reads the fixture yet and no runtime behaviour changes. This is the first step of &24004 (default emoji skin tone). The consumers are #633107 (the user preference and APIs), #633108 (server-side reaction toggling) and #633110 (the web picker, which bundles the fixture the same way it bundles fixtures/emojis/aliases.json).

Related to #633106.

Why the mapping comes from codepoints, and why a fixture
  • Emoji names cannot be used to find a base: 415 toned names end in _tone1.._tone5, 1,460 end in _skin_tone, and 5 are the bare modifiers tone1..tone5. Stripping the tone modifiers (U+1F3FB..U+1F3FF) and the variation selector (U+FE0F, which spy carries while its tones do not) from the glyph gives the base reliably: 322 base emoji, each with exactly five variants.
  • Two-person emoji whose people have different tones (260 names, for example handshake_light_skin_tone_medium_skin_tone) have no single tone. They are listed under mixed instead of being mapped to a base, so consumers can hide or keep them deliberately.
  • Three names are registered twice in the gem (man_in_tuxedo is 🤵 and 🤵‍♂️, also beetle and cricket). The module keeps the character TanukiEmoji.find_by_alpha_code returns, so the mapping agrees with the rest of the backend. Renaming them upstream would change what stored :beetle: and :cricket: awards render as, so that is tracked in gitlab-org/ruby/gems/tanuki_emoji#43 and not part of this change. The five man_in_tuxedo_*_skin_tone variants belong to 🤵‍♂️ and therefore have no base. They are listed under unmapped so consumers can treat them as variants rather than plain emoji.
  • A file under fixtures/emojis/ follows the existing aliases.json and intents.json pattern, which the frontend imports through the emojis/ alias. Adding the data to emojis.json would require an emoji asset version bump, which copies 3,780 files (24 MB).
  • The fixture-freshness spec fails if the committed JSON differs from a fresh generation, so the generated file does not need to be reviewed by hand.

References

  • Epic: &24004
  • Issue: #633106
  • Documentation step: doc/development/fe_guide/emojis.md

Screenshots or screen recordings

No UI change.

How to set up and validate locally

  1. bundle exec rake tanuki_emoji:skin_tones produces no diff on this branch.

  2. bin/rspec spec/lib/gitlab/emoji/skin_tones_spec.rb passes.

  3. In a Rails console:

    Gitlab::Emoji::SkinTones.variants_for('thumbsup')
    # => ["thumbsup_tone1", "thumbsup_tone2", "thumbsup_tone3", "thumbsup_tone4", "thumbsup_tone5"]
    Gitlab::Emoji::SkinTones.base_name('people_holding_hands_medium_skin_tone')
    # => "people_holding_hands"
    Gitlab::Emoji::SkinTones.mixed_tone_names.size
    # => 260
    Gitlab::Emoji::SkinTones.unmapped_names.size
    # => 5

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

🤖 Generated with Claude Code

Edited by Marcel van Remmerden

Merge request reports

Loading
Loading