Commit 6ade65a3 authored by Felipe Artur's avatar Felipe Artur Committed by Heinrich Lee Yu

Add group identification headers to epic emails

Add X-GitLab-Group-Id and X-GitLab-Group_Path headers
on epic emails.
parent 389f8c96
......@@ -5,6 +5,7 @@ module EE
module Notes
def note_epic_email(recipient_id, note_id, reason = nil)
setup_note_mail(note_id, recipient_id)
add_group_headers
@epic = @note.noteable
@target_url = group_epic_url(*note_target_url_options)
......
......@@ -26,5 +26,10 @@ module EE
group.full_name
end
def add_group_headers
headers['X-GitLab-Group-Id'] = group.id
headers['X-GitLab-Group-Path'] = group.full_path
end
end
end
......@@ -29,6 +29,8 @@ module Emails
@group = @epic.group
@target_url = group_epic_url(@epic.group, @epic)
add_group_headers
@sent_notification = SentNotification.record(@epic, recipient_id, reply_key)
end
......
---
title: Add group identification headers to epic emails
merge_request: 24878
author:
type: added
......@@ -298,6 +298,7 @@ describe Notify do
end
it_behaves_like 'it should show Gmail Actions View Epic link'
it_behaves_like 'an unsubscribeable thread'
it_behaves_like 'having group identification headers'
it 'has the correct subject and body' do
prefix = "#{epic.group.name} | "
......@@ -329,6 +330,8 @@ describe Notify do
it_behaves_like 'an unsubscribeable thread'
it_behaves_like 'having group identification headers'
it 'has the characteristics of a threaded reply' do
host = Gitlab.config.gitlab.host
route_key = "#{epic.class.model_name.singular_route_key}_#{epic.id}"
......
......@@ -23,4 +23,11 @@ RSpec.shared_examples 'an epic email starting a new thread with reply-by-email e
is_expected.to have_header 'Reply-To', /<reply@#{Gitlab.config.gitlab.host}>\Z/
end
end
RSpec.shared_examples 'having group identification headers' do
it 'has specific group headers' do
is_expected.to have_header 'X-GitLab-Group-Id', /#{group.id}/
is_expected.to have_header 'X-GitLab-Group-Path', /#{group.full_path}/
end
end
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