diff options
author | Robert Speicher <robert@gitlab.com> | 2016-04-12 17:38:21 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-04-12 17:38:21 +0000 |
commit | 6f4b4fd901d854cf6d06dcdd91d98d0512a9ec39 (patch) | |
tree | 8794ad7f8902524d213eafe2b084bde8e8bedae4 /lib/tasks | |
parent | c52c1922495d83b8ef877033ceab0abf2551bdf2 (diff) | |
parent | 1d1ca8b9c257f79ae75740cacad7d361635312b6 (diff) | |
download | gitlab-ce-6f4b4fd901d854cf6d06dcdd91d98d0512a9ec39.tar.gz |
Merge branch 'fix_emojis_not_showing_in_autocomplete' into 'master'
Fix emoji aliases not showing in autocomplete
closes #14948
See merge request !3595
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/gemojione.rake | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/tasks/gemojione.rake b/lib/tasks/gemojione.rake index 7ec00a898fd..030ee8bafcb 100644 --- a/lib/tasks/gemojione.rake +++ b/lib/tasks/gemojione.rake @@ -5,12 +5,23 @@ namespace :gemojione do require 'json' dir = Gemojione.index.images_path + digests = [] + aliases = Hash.new { |hash, key| hash[key] = [] } + aliases_path = File.join(Rails.root, 'fixtures', 'emojis', 'aliases.json') - digests = AwardEmoji.emojis.map do |name, emoji_hash| + JSON.parse(File.read(aliases_path)).each do |alias_name, real_name| + aliases[real_name] << alias_name + end + + AwardEmoji.emojis.map do |name, emoji_hash| fpath = File.join(dir, "#{emoji_hash['unicode']}.png") digest = Digest::SHA256.file(fpath).hexdigest - { name: name, unicode: emoji_hash['unicode'], digest: digest } + digests << { name: name, unicode: emoji_hash['unicode'], digest: digest } + + aliases[name].each do |alias_name| + digests << { name: alias_name, unicode: emoji_hash['unicode'], digest: digest } + end end out = File.join(Rails.root, 'fixtures', 'emojis', 'digests.json') |