mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 09:08:10 +08:00
FIX: don't escape html of poll options
This commit is contained in:
@ -157,14 +157,14 @@ after_initialize do
|
||||
# extract attributes
|
||||
p.attributes.values.each do |attribute|
|
||||
if attribute.name.start_with?(DATA_PREFIX)
|
||||
poll[attribute.name[DATA_PREFIX.length..-1]] = CGI::escapeHTML(attribute.value || "")
|
||||
poll[attribute.name[DATA_PREFIX.length..-1]] = CGI.escapeHTML(attribute.value || "")
|
||||
end
|
||||
end
|
||||
|
||||
# extract options
|
||||
p.css("li[#{DATA_PREFIX}option-id]").each do |o|
|
||||
option_id = CGI::escapeHTML(o.attributes[DATA_PREFIX + "option-id"].value || "")
|
||||
poll["options"] << { "id" => option_id, "html" => CGI::escapeHTML(o.inner_html), "votes" => 0 }
|
||||
option_id = o.attributes[DATA_PREFIX + "option-id"].value || ""
|
||||
poll["options"] << { "id" => option_id, "html" => o.inner_html, "votes" => 0 }
|
||||
end
|
||||
|
||||
# add the poll
|
||||
|
@ -7,7 +7,6 @@ describe PrettyText do
|
||||
HtmlNormalize.normalize(html)
|
||||
end
|
||||
|
||||
context 'markdown it' do
|
||||
it 'supports multi choice polls' do
|
||||
cooked = PrettyText.cook <<~MD
|
||||
[poll type=multiple min=1 max=3 public=true]
|
||||
@ -127,4 +126,3 @@ describe PrettyText do
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user