summaryrefslogtreecommitdiff
path: root/lib/tasks/gemojione.rake
diff options
context:
space:
mode:
authorArinde Eniola <eniolaarinde1@gmail.com>2016-04-09 13:29:37 +0100
committerArinde Eniola <eniolaarinde1@gmail.com>2016-04-09 13:29:37 +0100
commit1d1ca8b9c257f79ae75740cacad7d361635312b6 (patch)
tree62b06bd111dcd07a5df2d7715fd31a435c1da8f3 /lib/tasks/gemojione.rake
parent26f51bb07df7112cf00ed07e161088374bdb981c (diff)
downloadgitlab-ce-1d1ca8b9c257f79ae75740cacad7d361635312b6.tar.gz
fix emoji aliases not showing in autocompletefix_emojis_not_showing_in_autocomplete
Diffstat (limited to 'lib/tasks/gemojione.rake')
-rw-r--r--lib/tasks/gemojione.rake15
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')