Commit 16b54178 authored by Riyad Preukschas's avatar Riyad Preukschas

Use image Urls for Emoji in GFM

Fixes #2617
parent 7635afd0
......@@ -156,4 +156,9 @@ module ApplicationHelper
image_tag("authbuttons/#{file_name}",
alt: "Sign in with #{provider.to_s.titleize}")
end
def image_url(source)
root_url + path_to_image(source)
end
alias_method :url_to_image, :image_url
end
......@@ -119,7 +119,7 @@ module Gitlab
# parse emoji
text.gsub!(EMOJI_PATTERN) do |match|
if valid_emoji?($2)
image_tag("emoji/#{$2}.png", class: 'emoji', title: $1, alt: $1, size: "20x20")
image_tag(url_to_image("emoji/#{$2}.png"), class: 'emoji', title: $1, alt: $1, size: "20x20")
else
match
end
......
......@@ -343,5 +343,9 @@ describe GitlabMarkdownHelper do
it "should generate absolute urls for refs" do
markdown("##{issue.id}").should include(project_issue_url(project, issue))
end
it "should generate absolute urls for emoji" do
markdown(":smile:").should include("src=\"#{url_to_image("emoji/smile")}")
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment