Commit f69766ce authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '10220-link-to-note-from-email' into 'master'

Display link to each review note in text email

Closes #10220

See merge request gitlab-org/gitlab-ee!10401
parents e02ca324 0d3a50a5
<% note = local_assigns.fetch(:note, @note) -%>
<% diff_limit = local_assigns.fetch(:diff_limit, nil) -%>
<% target_url = local_assigns.fetch(:target_url, @target_url) -%>
<% discussion = note.discussion if note.part_of_discussion? -%>
<% if discussion && !discussion.individual_note? -%>
......@@ -13,6 +14,9 @@
<%= " on #{discussion.file_path}" -%>
<% end -%>
<%= ":" -%>
<% if discussion.diff_discussion? || !discussion.new_discussion? -%>
<%= " #{target_url}" -%>
<% end -%>
<% elsif Gitlab::CurrentSettings.email_author_in_body -%>
......
......@@ -2,7 +2,8 @@
--
<% @notes.each_with_index do |note, index| %>
<%= render 'note_email', note: note, diff_limit: 3 %>
<% target_url = project_merge_request_url(@project, @merge_request, anchor: "note_#{note.id}") %>
<%= render 'note_email', note: note, diff_limit: 3, target_url: target_url %>
<% if index != @notes.length-1 %>
--
......
---
title: Display link to review note in text email, similar to HTML email
merge_request: 10401
author:
type: changed
......@@ -278,8 +278,8 @@ describe Notify do
end
describe 'merge request reviews' do
let(:review) { create(:review, project: project, merge_request: merge_request) }
let(:notes) { create_list(:notes, 3, review: review, project: project, author: review.author, noteable: merge_request) }
let!(:review) { create(:review, project: project, merge_request: merge_request) }
let!(:notes) { create_list(:note, 3, review: review, project: project, author: review.author, noteable: merge_request) }
subject { described_class.new_review_email(recipient.id, review.id) }
......@@ -305,6 +305,19 @@ describe Notify do
end
end
context 'when diff note' do
let!(:notes) { create_list(:diff_note_on_merge_request, 3, review: review, project: project, author: review.author, noteable: merge_request) }
it 'links to notes' do
review.notes.each do |note|
# Text part
expect(subject.text_part.body.raw_source).to include(
project_merge_request_url(project, merge_request, anchor: "note_#{note.id}")
)
end
end
end
it 'contains review author name' do
is_expected.to have_body_text review.author_name
end
......
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