summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2016-11-22 12:46:00 +0000
committerSean McGivern <sean@gitlab.com>2016-11-28 19:40:48 +0000
commit93f6fcc91e5f241aeef13e96a16bbb6f4027e2fe (patch)
treeefab41c1e7caa8c1d07ef7b453672334aa0a5026
parent854fbbfb07b84394cc952d0ae20b7f29957e6555 (diff)
downloadgitlab-ce-93f6fcc91e5f241aeef13e96a16bbb6f4027e2fe.tar.gz
Don't remove + / - signs from diff emails
In the browser, we remove the + and - signs from the front of a diff line because we add them in with CSS, so they aren't copied. We can't do that in an email, because the CSS isn't supported, so we should keep them in that case.
-rw-r--r--app/helpers/diff_helper.rb4
-rw-r--r--app/views/projects/diffs/_line.html.haml2
2 files changed, 4 insertions, 2 deletions
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb
index f489f9aa0d6..ce16d971dc6 100644
--- a/app/helpers/diff_helper.rb
+++ b/app/helpers/diff_helper.rb
@@ -51,9 +51,11 @@ module DiffHelper
html.html_safe
end
- def diff_line_content(line)
+ def diff_line_content(line, email: false)
if line.blank?
"&nbsp;".html_safe
+ elsif email
+ line.html_safe
else
line.sub(/^[\-+ ]/, '').html_safe
end
diff --git a/app/views/projects/diffs/_line.html.haml b/app/views/projects/diffs/_line.html.haml
index a3e4b5b777e..bf2519d4f1c 100644
--- a/app/views/projects/diffs/_line.html.haml
+++ b/app/views/projects/diffs/_line.html.haml
@@ -25,7 +25,7 @@
%a{href: "##{line_code}", data: { linenumber: link_text }}
%td.line_content.noteable_line{ class: type, data: (diff_view_line_data(line_code, diff_file.position(line), type) unless plain) }<
- if email
- %pre= diff_line_content(line.text)
+ %pre= diff_line_content(line.text, email: true)
- else
= diff_line_content(line.text)