Skip to content
Snippets Groups Projects
Commit 36b255e5 authored by Aleks Bunin's avatar Aleks Bunin
Browse files

Addex X-GitLab-Project header to GitLab emails.

Fixes #8748.
parent 5bf33f97
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -111,6 +111,7 @@ class Notify < ActionMailer::Base
# See: mail_answer_thread
def mail_new_thread(model, headers = {}, &block)
headers['Message-ID'] = message_id(model)
headers['X-GitLab-Project'] = "#{@project.name} | " if @project
mail(headers, &block)
end
 
Loading
Loading
@@ -125,6 +126,7 @@ class Notify < ActionMailer::Base
def mail_answer_thread(model, headers = {}, &block)
headers['In-Reply-To'] = message_id(model)
headers['References'] = message_id(model)
headers['X-GitLab-Project'] = "#{@project.name} | " if @project
 
if (headers[:subject])
headers[:subject].prepend('Re: ')
Loading
Loading
Loading
Loading
@@ -26,6 +26,7 @@ describe Notify do
shared_examples 'an email starting a new thread' do |message_id_prefix|
it 'has a discussion identifier' do
should have_header 'Message-ID', /<#{message_id_prefix}(.*)@#{Gitlab.config.gitlab.host}>/
should have_header 'X-GitLab-Project', /#{project.name}/
end
end
 
Loading
Loading
@@ -37,6 +38,7 @@ describe Notify do
it 'has headers that reference an existing thread' do
should have_header 'References', /<#{thread_id_prefix}(.*)@#{Gitlab.config.gitlab.host}>/
should have_header 'In-Reply-To', /<#{thread_id_prefix}(.*)@#{Gitlab.config.gitlab.host}>/
should have_header 'X-GitLab-Project', /#{project.name}/
end
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment