whitelist style attribute in event_note
This commit is contained in:
parent
b696cbc5a0
commit
9bcd05401d
3 changed files with 17 additions and 1 deletions
|
@ -162,7 +162,12 @@ module EventsHelper
|
|||
|
||||
def event_note(text, options = {})
|
||||
text = first_line_in_markdown(text, 150, options)
|
||||
sanitize(text, tags: %w(a img b pre code p span))
|
||||
|
||||
sanitize(
|
||||
text,
|
||||
tags: %w(a img b pre code p span),
|
||||
attributes: Rails::Html::WhiteListSanitizer.allowed_attributes + ['style']
|
||||
)
|
||||
end
|
||||
|
||||
def event_commit_title(message)
|
||||
|
|
4
changelogs/unreleased/26790-label-color-todos.yml
Normal file
4
changelogs/unreleased/26790-label-color-todos.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: fix background color for labels mention in todo
|
||||
merge_request: 9155
|
||||
author: mhasbini
|
|
@ -61,6 +61,13 @@ describe EventsHelper do
|
|||
'</code></pre>'
|
||||
expect(helper.event_note(input)).to eq(expected)
|
||||
end
|
||||
|
||||
it 'preserves style attribute within a tag' do
|
||||
input = '<span class="" style="background-color: #44ad8e; color: #FFFFFF;"></span>'
|
||||
expected = '<p><span style="background-color: #44ad8e; color: #FFFFFF;"></span></p>'
|
||||
|
||||
expect(helper.event_note(input)).to eq(expected)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#event_commit_title' do
|
||||
|
|
Loading…
Reference in a new issue