diff options
author | Felipe Artur <felipefac@gmail.com> | 2017-11-09 17:59:39 -0200 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2017-11-09 18:04:58 -0200 |
commit | bf5de1386d6c8d91a2497cd1c7195aad1a1b4a63 (patch) | |
tree | 0d7c63257f7b167e61123004de31aaac05be3735 | |
parent | 1bf689563bfde933cd3e8d3fb58cb36c1a45d3af (diff) | |
download | gitlab-ce-issue_39238.tar.gz |
Fix image diff notes emailissue_39238
-rw-r--r-- | app/views/notify/_note_email.html.haml | 10 | ||||
-rw-r--r-- | changelogs/unreleased/issue_39238.yml | 5 | ||||
-rw-r--r-- | spec/mailers/notify_spec.rb | 12 |
3 files changed, 23 insertions, 4 deletions
diff --git a/app/views/notify/_note_email.html.haml b/app/views/notify/_note_email.html.haml index a80518f7986..eacd468d3e6 100644 --- a/app/views/notify/_note_email.html.haml +++ b/app/views/notify/_note_email.html.haml @@ -1,10 +1,14 @@ - 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 +25,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' diff --git a/changelogs/unreleased/issue_39238.yml b/changelogs/unreleased/issue_39238.yml new file mode 100644 index 00000000000..b5723b65168 --- /dev/null +++ b/changelogs/unreleased/issue_39238.yml @@ -0,0 +1,5 @@ +--- +title: Fix image diff notes email +merge_request: +author: +type: fixed diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index c832cee965b..aa8b7f7b975 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -783,7 +783,17 @@ 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 + end + + it 'includes diffs with character-level highlighting' do is_expected.to have_body_text '<span class="p">}</span></span>' end |