Skip to content
Snippets Groups Projects
Commit 8423ed74 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 2af6d2c4
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -51,12 +51,15 @@ module MarkupHelper
text = fragment.children[0].text
fragment.children[0].replace(link_to(text, url, html_options))
else
# Traverse the fragment's first generation of children looking for pure
# text, wrapping anything found in the requested link
# Traverse the fragment's first generation of children looking for
# either pure text or emojis, wrapping anything found in the
# requested link
fragment.children.each do |node|
next unless node.text?
node.replace(link_to(node.text, url, html_options))
if node.text?
node.replace(link_to(node.text, url, html_options))
elsif node.name == 'gl-emoji'
node.replace(link_to(node.to_html.html_safe, url, html_options))
end
end
end
 
Loading
Loading
---
title: Allow emojis to be linkable
merge_request: 18014
author:
type: fixed
This diff is collapsed.
This diff is collapsed.
Loading
Loading
@@ -210,7 +210,7 @@ describe MarkupHelper do
it 'replaces commit message with emoji to link' do
actual = link_to_markdown(':book: Book', '/foo')
expect(actual)
.to eq '<gl-emoji title="open book" data-name="book" data-unicode-version="6.0">📖</gl-emoji><a href="/foo"> Book</a>'
.to eq '<a href="/foo"><gl-emoji title="open book" data-name="book" data-unicode-version="6.0">📖</gl-emoji></a><a href="/foo"> Book</a>'
end
end
 
Loading
Loading
@@ -232,6 +232,12 @@ describe MarkupHelper do
expect(doc.css('a')[0].attr('href')).to eq link
expect(doc.css('a')[0].text).to eq 'This should finally fix '
end
it "escapes HTML passed as an emoji" do
rendered = '<gl-emoji>&lt;div class="test"&gt;test&lt;/div&gt;</gl-emoji>'
expect(helper.link_to_html(rendered, '/foo'))
.to eq '<a href="/foo"><gl-emoji>&lt;div class="test"&gt;test&lt;/div&gt;</gl-emoji></a>'
end
end
 
describe '#render_wiki_content' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment