summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-04-14 18:22:49 +0000
committerRobert Speicher <robert@gitlab.com>2016-04-14 18:22:49 +0000
commit97fd9616ac1cb855d9682c311d8eac8c57479c9f (patch)
tree213d08230242310b38a4f6170e269da4c0988f93 /lib
parent9cd5e0fc48c408f96a06c0a2b81bc70dfea9d98d (diff)
parent6ae2680ce7159eedd37e89c7aa99688949139f11 (diff)
downloadgitlab-ce-97fd9616ac1cb855d9682c311d8eac8c57479c9f.tar.gz
Merge branch 'emoji_category_fix' into 'master'
Emoji categories fix Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/14020 See merge request !3727
Diffstat (limited to 'lib')
-rw-r--r--lib/award_emoji.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/award_emoji.rb b/lib/award_emoji.rb
index 4fc3443ac68..5f8ff01b0a9 100644
--- a/lib/award_emoji.rb
+++ b/lib/award_emoji.rb
@@ -14,19 +14,29 @@ class AwardEmoji
food_drink: "Food"
}.with_indifferent_access
+ CATEGORY_ALIASES = {
+ symbols: "objects_symbols",
+ foods: "food_drink",
+ travel: "travel_places"
+ }.with_indifferent_access
+
def self.normilize_emoji_name(name)
aliases[name] || name
end
def self.emoji_by_category
unless @emoji_by_category
- @emoji_by_category = {}
+ @emoji_by_category = Hash.new { |h, key| h[key] = [] }
emojis.each do |emoji_name, data|
data["name"] = emoji_name
- @emoji_by_category[data["category"]] ||= []
- @emoji_by_category[data["category"]] << data
+ # Skip Fitzpatrick(tone) modifiers
+ next if data["category"] == "modifier"
+
+ category = CATEGORY_ALIASES[data["category"]] || data["category"]
+
+ @emoji_by_category[category] << data
end
@emoji_by_category = @emoji_by_category.sort.to_h