diff options
author | Rémy Coutable <remy@rymai.me> | 2017-03-16 11:03:35 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-03-16 14:36:04 +0100 |
commit | b196ee31d7124c4a4b3b3a23b99970e03378bd1d (patch) | |
tree | 3a3530c491fcea6058b26c2186fd55dd6da2f7fe /lib | |
parent | 4a81867df14801c302f72096de8ee5327cfb4a39 (diff) | |
download | gitlab-ce-b196ee31d7124c4a4b3b3a23b99970e03378bd1d.tar.gz |
This quick-fixes an issue with existing award emoji not being valid anymore
Gitlab::Emoji#gl_emoji_tag now returns early instead of raising a 500 error.
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/emoji.rb | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/lib/gitlab/emoji.rb b/lib/gitlab/emoji.rb index 35871fd1b7b..a16d9fc2265 100644 --- a/lib/gitlab/emoji.rb +++ b/lib/gitlab/emoji.rb @@ -44,27 +44,17 @@ module Gitlab end # CSS sprite fallback takes precedence over image fallback - def gl_emoji_tag(name, image: false, sprite: false, force_fallback: false) + def gl_emoji_tag(name) emoji_name = emojis_aliases[name] || name emoji_info = emojis[emoji_name] - emoji_fallback_image_source = ActionController::Base.helpers.url_to_image("emoji/#{emoji_info['name']}.png") - emoji_fallback_sprite_class = "emoji-#{emoji_name}" + return unless emoji_info data = { name: emoji_name, unicode_version: emoji_unicode_version(emoji_name) } - data[:fallback_src] = emoji_fallback_image_source if image - data[:fallback_sprite_class] = emoji_fallback_sprite_class if sprite - ActionController::Base.helpers.content_tag 'gl-emoji', - class: ("emoji-icon #{emoji_fallback_sprite_class}" if force_fallback && sprite), - data: data do - if force_fallback && !sprite - emoji_image_tag(emoji_name, emoji_fallback_image_source) - else - emoji_info['moji'] - end - end + + ActionController::Base.helpers.content_tag('gl-emoji', emoji_info['moji'], data: data) end end end |