summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-11-29 04:11:15 +0000
committerDouwe Maan <douwe@gitlab.com>2016-11-29 04:11:15 +0000
commitb0bde100f2480d77a72bdbd777fb0ef2b8ff4024 (patch)
tree1ffe6fda6d12f3f33a02c65cb9c6443563b7190f /app/models
parent3bf34face4cacf07ca973705c261369b1f596626 (diff)
parent87665170eccfc423fc3f7fe2cadd208d808a6847 (diff)
downloadgitlab-ce-b0bde100f2480d77a72bdbd777fb0ef2b8ff4024.tar.gz
Merge branch 'hoopes/gitlab-ce-21027-add-diff-hunks-to-notification-emails' into 'master'
Add diff hunks to notification emails Add diff hunks to notification emails. Continued from https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5855 - thanks @hoopes! This also fixes an issue where the + / - prefixes were missing from diffs in emails. Screenshots (from my browser) of the HTML emails, along with text screenshots :stuck_out_tongue: ![image](/uploads/cb31400becf5149d40c8bb98a655aa93/image.png) ``` New comment for Merge Request !1 on app/views/admin/builds/index.html.haml: http://localhost:3000/gitlab-org/gitlab-ce/merge_requests/1#note_1023 > Finished This is a comment at the top of a match section. ``` ![image](/uploads/704dd3845797530697a27f5c1953c053/image.png) ``` New comment for Merge Request !1 on app/views/admin/builds/index.html.haml: http://localhost:3000/gitlab-org/gitlab-ce/merge_requests/1#note_1022 > Finished > %span.badge.js-running-count= @all_builds.finished.count(:id) > > - %li{class: ('active' if @scope == 'all')} > - = link_to admin_builds_path(scope: :all) do > - All > - %span.badge.js-totalbuilds-count= @all_builds.count(:id) > - > .gray-content-block > #{(@scope || 'running').capitalize} builds > This is a comment at the bottom of a match section. ``` ![image](/uploads/4063f3d9738aea8ebf3c0e690d0eddee/image.png) ``` New comment for Merge Request !1 on app/views/admin/builds/index.html.haml: http://localhost:3000/gitlab-org/gitlab-ce/merge_requests/1#note_1024 > = link_to 'Cancel all', cancel_all_admin_builds_path, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger', method: :post > > %ul.center-top-menu > - %li{class: ('active' if @scope.nil?)} > + %li{class: ('active' if @scope == 'all')} > = link_to admin_builds_path do > + All This is a comment with some deleted and added lines above it. ``` Closes #21027, closes #24340. See merge request !7660
Diffstat (limited to 'app/models')
-rw-r--r--app/models/discussion.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/models/discussion.rb b/app/models/discussion.rb
index de06c13481a..75a85563235 100644
--- a/app/models/discussion.rb
+++ b/app/models/discussion.rb
@@ -25,7 +25,12 @@ class Discussion
to: :last_resolved_note,
allow_nil: true
- delegate :blob, :highlighted_diff_lines, to: :diff_file, allow_nil: true
+ delegate :blob,
+ :highlighted_diff_lines,
+ :diff_lines,
+
+ to: :diff_file,
+ allow_nil: true
def self.for_notes(notes)
notes.group_by(&:discussion_id).values.map { |notes| new(notes) }
@@ -159,10 +164,11 @@ class Discussion
end
# Returns an array of at most 16 highlighted lines above a diff note
- def truncated_diff_lines
+ def truncated_diff_lines(highlight: true)
+ lines = highlight ? highlighted_diff_lines : diff_lines
prev_lines = []
- highlighted_diff_lines.each do |line|
+ lines.each do |line|
if line.meta?
prev_lines.clear
else