Commit b8965389 authored by Nikola Milojevic's avatar Nikola Milojevic

Merge branch 'tanuki-emoji-aliases' into 'master'

Add allowlisted ASCII aliases in Rake task

See merge request gitlab-org/gitlab!82175
parents 1fb42d92 065c507a
......@@ -290,7 +290,7 @@ gem 'autoprefixer-rails', '10.2.5.1'
gem 'terser', '1.0.2'
gem 'addressable', '~> 2.8'
gem 'tanuki_emoji', '~> 0.5'
gem 'tanuki_emoji', '~> 0.6'
gem 'gon', '~> 6.4.0'
gem 'request_store', '~> 1.5'
gem 'base32', '~> 0.3.0'
......
......@@ -1261,7 +1261,7 @@ GEM
sys-filesystem (1.4.3)
ffi (~> 1.1)
sysexits (1.2.0)
tanuki_emoji (0.5.0)
tanuki_emoji (0.6.0)
temple (0.8.2)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
......@@ -1649,7 +1649,7 @@ DEPENDENCIES
stackprof (~> 0.2.15)
state_machines-activerecord (~> 0.8.0)
sys-filesystem (~> 1.4.3)
tanuki_emoji (~> 0.5)
tanuki_emoji (~> 0.6)
terser (= 1.0.2)
test-prof (~> 1.0.7)
test_file_finder (~> 0.1.3)
......
......@@ -219,14 +219,14 @@ To update the Emoji aliases file (used for Emoji autocomplete), run the
following:
```shell
bundle exec rake gemojione:aliases
bundle exec rake tanuki_emoji:aliases
```
To update the Emoji digests file (used for Emoji autocomplete), run the
following:
```shell
bundle exec rake gemojione:digests
bundle exec rake tanuki_emoji:digests
```
This updates the file `fixtures/emojis/digests.json` based on the currently
......@@ -235,7 +235,7 @@ available Emoji.
To generate a sprite file containing all the Emoji, run:
```shell
bundle exec rake gemojione:sprite
bundle exec rake tanuki_emoji:sprite
```
If new emoji are added, the sprite sheet may change size. To compensate for
......
{
":) ":"smile",
":( ":"disappointed",
"small_airplane":"airplane_small",
"right_anger_bubble":"anger_right",
"keycap_asterisk":"asterisk",
......@@ -54,6 +52,7 @@
"passenger_ship":"cruise_ship",
"dagger_knife":"dagger",
"desktop_computer":"desktop",
":( ":"disappointed",
"card_index_dividers":"dividers",
"dove_of_peace":"dove",
"drool":"drooling_face",
......@@ -488,6 +487,7 @@
"skull_and_crossbones":"skull_crossbones",
"slightly_frowning_face":"slight_frown",
"slightly_smiling_face":"slight_smile",
":) ":"smile",
"sneeze":"sneezing_face",
"speaking_head_in_silhouette":"speaking_head",
"left_speech_bubble":"speech_left",
......
......@@ -3,12 +3,20 @@
namespace :tanuki_emoji do
desc 'Generates Emoji aliases fixtures'
task aliases: :environment do
ALLOWED_ALIASES = [':)', ':('].freeze
aliases = {}
TanukiEmoji.index.all.each do |emoji|
emoji.aliases.each do |emoji_alias|
aliases[TanukiEmoji::Character.format_name(emoji_alias)] = emoji.name
end
emoji.ascii_aliases.intersection(ALLOWED_ALIASES).each do |ascii_alias|
# We add an extra space at the end so that when a user types ":) "
# we'd still match this alias and not show "cocos (keeling) islands" as the first result.
# The initial ":" is ignored when matching because it's our emoji prefix in Markdown.
aliases[ascii_alias + ' '] = emoji.name
end
end
aliases_json_file = File.join(Rails.root, 'fixtures', 'emojis', 'aliases.json')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment