summaryrefslogtreecommitdiff
path: root/app/views/notify
diff options
context:
space:
mode:
authorhhoopes <heidih@gmail.com>2016-08-31 10:18:26 -0600
committerSean McGivern <sean@gitlab.com>2016-11-25 15:23:49 +0000
commita761c59a6bfc4d66649910d01e4c8412bb0b40ec (patch)
treec2c06dbbc20d140bda5ed2cd6abfa0e2f36805d0 /app/views/notify
parentf928dba99b0550cefa7534d7fd5bd1ea16609274 (diff)
downloadgitlab-ce-a761c59a6bfc4d66649910d01e4c8412bb0b40ec.tar.gz
Add keyword arguments to truncated_diff method
* Added keyword arguments to truncated_diff_lines method to allow for using highlighting or not (html templates vs. text) * Tweaked templates for consistency and format appropriateness
Diffstat (limited to 'app/views/notify')
-rw-r--r--app/views/notify/_note_message.text.erb5
-rw-r--r--app/views/notify/_note_mr_or_commit_email.html.haml11
-rw-r--r--app/views/notify/_note_mr_or_commit_email.text.erb8
-rw-r--r--app/views/notify/_simple_diff.text.erb5
-rw-r--r--app/views/notify/note_commit_email.html.haml3
-rw-r--r--app/views/notify/note_commit_email.text.erb13
-rw-r--r--app/views/notify/note_merge_request_email.html.haml3
-rw-r--r--app/views/notify/note_merge_request_email.text.erb13
8 files changed, 28 insertions, 33 deletions
diff --git a/app/views/notify/_note_message.text.erb b/app/views/notify/_note_message.text.erb
new file mode 100644
index 00000000000..f82cbc9a3fc
--- /dev/null
+++ b/app/views/notify/_note_message.text.erb
@@ -0,0 +1,5 @@
+<% if current_application_settings.email_author_in_body %>
+ <%= @note.author_name %> wrote:
+<% end -%>
+
+<%= @note.note %>
diff --git a/app/views/notify/_note_mr_or_commit_email.html.haml b/app/views/notify/_note_mr_or_commit_email.html.haml
index 7033842b557..15e92c42b14 100644
--- a/app/views/notify/_note_mr_or_commit_email.html.haml
+++ b/app/views/notify/_note_mr_or_commit_email.html.haml
@@ -1,17 +1,20 @@
= content_for :head do
= stylesheet_link_tag 'mailers/highlighted_diff_email'
+New comment
+
- if @note.diff_note? && @note.diff_file
on
= link_to @note.diff_file.file_path, @target_url, class: 'details'
- \:
+\:
+- if @discussion
%table
= render partial: "projects/diffs/line",
- collection: @discussion.highlighted_diff_lines(@discussion.truncated_diff_lines),
+ collection: @discussion.truncated_diff_lines,
as: :line,
locals: { diff_file: @note.diff_file,
- plain: true,
- email: true }
+ plain: true,
+ email: true }
= render 'note_message'
diff --git a/app/views/notify/_note_mr_or_commit_email.text.erb b/app/views/notify/_note_mr_or_commit_email.text.erb
new file mode 100644
index 00000000000..3dd1b4d4c0e
--- /dev/null
+++ b/app/views/notify/_note_mr_or_commit_email.text.erb
@@ -0,0 +1,8 @@
+<% if @note.diff_note? && @note.diff_file -%>
+ on <%= @note.diff_file.file_path -%>
+<% end -%>:
+
+<%= url %>
+
+<%= render 'simple_diff' if @discussion -%>
+<%= render 'note_message' %>
diff --git a/app/views/notify/_simple_diff.text.erb b/app/views/notify/_simple_diff.text.erb
index a5a796bc168..58b0018c0ca 100644
--- a/app/views/notify/_simple_diff.text.erb
+++ b/app/views/notify/_simple_diff.text.erb
@@ -1,4 +1,3 @@
-<% lines = @discussion.truncated_diff_lines %>
-<% @discussion.text_parsed_diff_lines(lines).each do |line| %>
- <%= line %>
+<% @discussion.truncated_diff_lines(highlight: false).each do |line| %>
+ <%= "> " + line.text %>
<% end %>
diff --git a/app/views/notify/note_commit_email.html.haml b/app/views/notify/note_commit_email.html.haml
index 17dcf36689f..0a650e3b2ca 100644
--- a/app/views/notify/note_commit_email.html.haml
+++ b/app/views/notify/note_commit_email.html.haml
@@ -1,5 +1,2 @@
%p.details
- New comment for Commit
- = @commit.short_id
-
= render 'note_mr_or_commit_email'
diff --git a/app/views/notify/note_commit_email.text.erb b/app/views/notify/note_commit_email.text.erb
index 715e58af61c..dc764b61659 100644
--- a/app/views/notify/note_commit_email.text.erb
+++ b/app/views/notify/note_commit_email.text.erb
@@ -1,11 +1,4 @@
-New comment for Commit <%= @commit.short_id %>
+<% url = url_for(namespace_project_commit_url(@note.project.namespace, @note.project, id: @commit.id, anchor: "note_#{@note.id}")) %>
-<%= url_for(namespace_project_commit_url(@note.project.namespace, @note.project, id: @commit.id, anchor: "note_#{@note.id}")) %>
-
-<%= render 'simple_diff' if @discussion %>
-
-<% if current_application_settings.email_author_in_body %>
- <%= @note.author_name %> wrote:
-<% end %>
-
-<%= @note.note %>
+New comment for Commit <%= @commit.short_id -%>
+<%= render partial: 'note_mr_or_commit_email', locals: { url: url } %>
diff --git a/app/views/notify/note_merge_request_email.html.haml b/app/views/notify/note_merge_request_email.html.haml
index b7758f191dc..0a650e3b2ca 100644
--- a/app/views/notify/note_merge_request_email.html.haml
+++ b/app/views/notify/note_merge_request_email.html.haml
@@ -1,5 +1,2 @@
%p.details
- New comment for Merge Request
- = @merge_request.to_reference
-
= render 'note_mr_or_commit_email'
diff --git a/app/views/notify/note_merge_request_email.text.erb b/app/views/notify/note_merge_request_email.text.erb
index d24e15af91f..e33d15daded 100644
--- a/app/views/notify/note_merge_request_email.text.erb
+++ b/app/views/notify/note_merge_request_email.text.erb
@@ -1,11 +1,4 @@
-New comment for Merge Request <%= @merge_request.to_reference %>
+<% url = url_for(namespace_project_merge_request_url(@merge_request.target_project.namespace, @merge_request.target_project, @merge_request, anchor: "note_#{@note.id}")) %>
-<%= url_for(namespace_project_merge_request_url(@merge_request.target_project.namespace, @merge_request.target_project, @merge_request, anchor: "note_#{@note.id}")) %>
-
-<%= render 'simple_diff' if @discussion %>
-
-<% if current_application_settings.email_author_in_body %>
- <%= @note.author_name %> wrote:
-<% end %>
-
-<%= @note.note %>
+New comment for Merge Request <%= @merge_request.to_reference -%>
+<%= render partial: 'note_mr_or_commit_email', locals: { url: url }%>