diff options
author | Eric Eastwood <contact@ericeastwood.com> | 2017-03-03 20:56:02 +0300 |
---|---|---|
committer | Eric Eastwood <contact@ericeastwood.com> | 2017-03-06 21:54:46 +0300 |
commit | f602efea65c2a816c7e29be546d2eb412fe538cc (patch) | |
tree | 3b58078142d489dd2cd69a782830e92f687b3ca3 /lib | |
parent | 2d6492561c8b34595abc3638f8991d7aa6af7151 (diff) |
Fix wrong image src with cached gl-emoji and relative root
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/emoji.rb | 6 | ||||
-rw-r--r-- | lib/gitlab/gon_helper.rb | 1 |
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/gitlab/emoji.rb b/lib/gitlab/emoji.rb index 35712c214fc..3ef92abd3cf 100644 --- a/lib/gitlab/emoji.rb +++ b/lib/gitlab/emoji.rb @@ -41,12 +41,12 @@ module Gitlab end # CSS sprite fallback takes precedence over image fallback - def gl_emoji_tag(name, sprite: false, force_fallback: false) + def gl_emoji_tag(name, image: false, sprite: false, force_fallback: false) emoji_name = emojis_aliases[name] || name emoji_info = emojis[emoji_name] - emoji_fallback_image_source = ActionController::Base.helpers.asset_url("emoji/#{emoji_info['name']}.png") + emoji_fallback_image_source = ActionController::Base.helpers.url_to_image("emoji/#{emoji_info['name']}.png") emoji_fallback_sprite_class = "emoji-#{emoji_name}" - "<gl-emoji #{force_fallback && sprite ? "class='emoji-icon #{emoji_fallback_sprite_class}'" : ""} data-name='#{emoji_name}' data-fallback-src='#{emoji_fallback_image_source}' #{sprite ? "data-fallback-sprite-class='#{emoji_fallback_sprite_class}'" : ""} data-unicode-version='#{emoji_unicode_version(emoji_name)}'>#{force_fallback && sprite === false ? emoji_image_tag(emoji_name, emoji_fallback_image_source) : emoji_info['moji']}</gl-emoji>" + "<gl-emoji #{force_fallback && sprite ? "class='emoji-icon #{emoji_fallback_sprite_class}'" : ""} data-name='#{emoji_name}' #{image ? "data-fallback-src='#{emoji_fallback_image_source}'" : ""} #{sprite ? "data-fallback-sprite-class='#{emoji_fallback_sprite_class}'" : ""} data-unicode-version='#{emoji_unicode_version(emoji_name)}'>#{force_fallback && sprite === false ? emoji_image_tag(emoji_name, emoji_fallback_image_source) : emoji_info['moji']}</gl-emoji>" end end end diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb index 57fc4eb7c18..1cfede5460f 100644 --- a/lib/gitlab/gon_helper.rb +++ b/lib/gitlab/gon_helper.rb @@ -4,6 +4,7 @@ module Gitlab gon.api_version = 'v3' # v4 Is not officially released yet, therefore can't be considered as "frozen" gon.default_avatar_url = URI.join(Gitlab.config.gitlab.url, ActionController::Base.helpers.image_path('no_avatar.png')).to_s gon.max_file_size = current_application_settings.max_attachment_size + gon.asset_host = ActionController::Base.asset_host gon.relative_url_root = Gitlab.config.gitlab.relative_url_root gon.shortcuts_path = help_page_path('shortcuts') gon.user_color_scheme = Gitlab::ColorSchemes.for_user(current_user).css_class |