Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
2af6d2c437
commit
8423ed74e6
|
@ -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
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Allow emojis to be linkable
|
||||
merge_request: 18014
|
||||
author:
|
||||
type: fixed
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -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
|
||||
|
||||
|
@ -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><div class="test">test</div></gl-emoji>'
|
||||
expect(helper.link_to_html(rendered, '/foo'))
|
||||
.to eq '<a href="/foo"><gl-emoji><div class="test">test</div></gl-emoji></a>'
|
||||
end
|
||||
end
|
||||
|
||||
describe '#render_wiki_content' do
|
||||
|
|
Loading…
Reference in New Issue