Make diff_line_content helper return a safe String. #3945

This commit is contained in:
Rubén Dávila 2016-01-12 11:02:16 -05:00
parent ee2230c329
commit 80a4c808b1
4 changed files with 5 additions and 5 deletions

View file

@ -111,9 +111,9 @@ module DiffHelper
def diff_line_content(line)
if line.blank?
"  "
"  ".html_safe
else
line
line.try(:html_safe)
end
end

View file

@ -20,6 +20,6 @@
- else
%td.old_line
%td.new_line
%td.line_content{class: "#{line.type}"}= raw diff_line_content(line.text)
%td.line_content{class: "#{line.type}"}= diff_line_content(line.text)
- else
.nothing-here-block No changes.

View file

@ -22,7 +22,7 @@
= link_to_new_diff_note(line_code)
%td.new_line{data: {linenumber: line.new_pos}}
= link_to raw(type == "old" ? " " : line.new_pos), "##{line_code}", id: line_code
%td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= diff_line_content(line.text).html_safe
%td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= diff_line_content(line.text)
- if @reply_allowed
- comments = @line_notes.select { |n| n.line_code == line_code && n.active? }.sort_by(&:created_at)

View file

@ -24,7 +24,7 @@
= raw(type == "new" ? " " : line.old_pos)
%td.new_line
= raw(type == "old" ? " " : line.new_pos)
%td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line.text)
%td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= diff_line_content(line.text)
- if line_code == note.line_code
= render "projects/notes/diff_notes_with_reply", notes: discussion_notes