Commit 3582c6ab authored by Sean McGivern's avatar Sean McGivern

Merge branch 'issue_39238' into 'master'

Fix image diff notes email

Closes #39238

See merge request gitlab-org/gitlab-ce!15299
parents 1c116bc9 5dd28621
- discussion = @note.discussion if @note.part_of_discussion?
- diff_discussion = discussion&.diff_discussion?
- on_image = discussion.on_image? if diff_discussion
- if discussion
- phrase_end_char = on_image ? "." : ":"
%p.details
= succeed ':' do
= succeed phrase_end_char do
= link_to @note.author_name, user_url(@note.author)
- if discussion.diff_discussion?
- if diff_discussion
- if discussion.new_discussion?
started a new discussion
- else
......@@ -21,7 +26,7 @@
%p.details
#{link_to @note.author_name, user_url(@note.author)} commented:
- if discussion&.diff_discussion?
- if diff_discussion && !on_image
= content_for :head do
= stylesheet_link_tag 'mailers/highlighted_diff_email'
......
---
title: Fix image diff notification email from showing wrong content
merge_request:
author:
type: fixed
......@@ -783,7 +783,25 @@ describe Notify do
shared_examples 'an email for a note on a diff discussion' do |model|
let(:note) { create(model, author: note_author) }
it "includes diffs with character-level highlighting" do
context 'when note is on image' do
before do
allow_any_instance_of(DiffDiscussion).to receive(:on_image?).and_return(true)
end
it 'does not include diffs with character-level highlighting' do
is_expected.not_to have_body_text '<span class="p">}</span></span>'
end
it 'ends the intro with a dot' do
is_expected.to have_body_text "#{note.diff_file.file_path}</a>."
end
end
it 'ends the intro with a colon' do
is_expected.to have_body_text "#{note.diff_file.file_path}</a>:"
end
it 'includes diffs with character-level highlighting' do
is_expected.to have_body_text '<span class="p">}</span></span>'
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