BigW Consortium Gitlab

Commit 80a4c808 by Rubén Dávila

Make diff_line_content helper return a safe String. #3945

parent ee2230c3
...@@ -111,9 +111,9 @@ module DiffHelper ...@@ -111,9 +111,9 @@ module DiffHelper
def diff_line_content(line) def diff_line_content(line)
if line.blank? if line.blank?
"  " "  ".html_safe
else else
line line.try(:html_safe)
end end
end end
......
...@@ -20,6 +20,6 @@ ...@@ -20,6 +20,6 @@
- else - else
%td.old_line %td.old_line
%td.new_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 - else
.nothing-here-block No changes. .nothing-here-block No changes.
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
= link_to_new_diff_note(line_code) = link_to_new_diff_note(line_code)
%td.new_line{data: {linenumber: line.new_pos}} %td.new_line{data: {linenumber: line.new_pos}}
= link_to raw(type == "old" ? " " : line.new_pos), "##{line_code}", id: line_code = 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 - if @reply_allowed
- comments = @line_notes.select { |n| n.line_code == line_code && n.active? }.sort_by(&:created_at) - comments = @line_notes.select { |n| n.line_code == line_code && n.active? }.sort_by(&:created_at)
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
= raw(type == "new" ? " " : line.old_pos) = raw(type == "new" ? " " : line.old_pos)
%td.new_line %td.new_line
= raw(type == "old" ? " " : line.new_pos) = 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 - if line_code == note.line_code
= render "projects/notes/diff_notes_with_reply", notes: discussion_notes = render "projects/notes/diff_notes_with_reply", notes: discussion_notes
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment