Merge pull request #8749 from sashkab/b8748-emailheader
Addex X-GitLab-Project header to GitLab emails.
This commit is contained in:
commit
8c12c93e07
2 changed files with 4 additions and 0 deletions
|
@ -111,6 +111,7 @@ class Notify < ActionMailer::Base
|
||||||
# See: mail_answer_thread
|
# See: mail_answer_thread
|
||||||
def mail_new_thread(model, headers = {}, &block)
|
def mail_new_thread(model, headers = {}, &block)
|
||||||
headers['Message-ID'] = message_id(model)
|
headers['Message-ID'] = message_id(model)
|
||||||
|
headers['X-GitLab-Project'] = "#{@project.name} | " if @project
|
||||||
mail(headers, &block)
|
mail(headers, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -125,6 +126,7 @@ class Notify < ActionMailer::Base
|
||||||
def mail_answer_thread(model, headers = {}, &block)
|
def mail_answer_thread(model, headers = {}, &block)
|
||||||
headers['In-Reply-To'] = message_id(model)
|
headers['In-Reply-To'] = message_id(model)
|
||||||
headers['References'] = message_id(model)
|
headers['References'] = message_id(model)
|
||||||
|
headers['X-GitLab-Project'] = "#{@project.name} | " if @project
|
||||||
|
|
||||||
if (headers[:subject])
|
if (headers[:subject])
|
||||||
headers[:subject].prepend('Re: ')
|
headers[:subject].prepend('Re: ')
|
||||||
|
|
|
@ -31,6 +31,7 @@ describe Notify do
|
||||||
shared_examples 'an email starting a new thread' do |message_id_prefix|
|
shared_examples 'an email starting a new thread' do |message_id_prefix|
|
||||||
it 'has a discussion identifier' do
|
it 'has a discussion identifier' do
|
||||||
should have_header 'Message-ID', /<#{message_id_prefix}(.*)@#{Gitlab.config.gitlab.host}>/
|
should have_header 'Message-ID', /<#{message_id_prefix}(.*)@#{Gitlab.config.gitlab.host}>/
|
||||||
|
should have_header 'X-GitLab-Project', /#{project.name}/
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -42,6 +43,7 @@ describe Notify do
|
||||||
it 'has headers that reference an existing thread' do
|
it 'has headers that reference an existing thread' do
|
||||||
should have_header 'References', /<#{thread_id_prefix}(.*)@#{Gitlab.config.gitlab.host}>/
|
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 'In-Reply-To', /<#{thread_id_prefix}(.*)@#{Gitlab.config.gitlab.host}>/
|
||||||
|
should have_header 'X-GitLab-Project', /#{project.name}/
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue