summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-10-01 16:28:10 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-10-01 16:28:10 +0200
commit63bbe42c9cc5c23e090849022df60b2e45ee35d5 (patch)
tree95be812f6298499ed0f5fb8c160f06c7ca472ebe
parent73520b4307a70f948acca586a9df56c9618feba6 (diff)
parent2e92600b30b4e935fb8ba125d99124539545d901 (diff)
downloadgitlab-ce-63bbe42c9cc5c23e090849022df60b2e45ee35d5.tar.gz
Merge branch 'stanhu/gitlab-ce-fix-message-id-notify'
-rw-r--r--CHANGELOG1
-rw-r--r--app/mailers/notify.rb2
-rw-r--r--spec/mailers/notify_spec.rb1
3 files changed, 3 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index b5d7641f9cb..c6eba9c8734 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.1.0 (unreleased)
- Include full path of source and target branch names in New Merge Request page (Stan Hu)
+ - Fix Message-ID header to be RFC 2111-compliant to prevent e-mails being dropped (Stan Hu)
- Add user preference to view activities as default dashboard (Stan Hu)
- Add option to admin area to sign in as a specific user (Pavel Forkert)
- Show CI status on all pages where commits list is rendered
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb
index db2f9654e14..50a409c3754 100644
--- a/app/mailers/notify.rb
+++ b/app/mailers/notify.rb
@@ -140,7 +140,7 @@ class Notify < BaseMailer
# * have a 'In-Reply-To' or 'References' header that references the original 'Message-ID'
#
def mail_answer_thread(model, headers = {})
- headers['Message-ID'] = SecureRandom.hex
+ headers['Message-ID'] = "<#{SecureRandom.hex}@#{Gitlab.config.gitlab.host}>"
headers['In-Reply-To'] = message_id(model)
headers['References'] = message_id(model)
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index 42481a9ea38..cb67ec95d57 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -52,6 +52,7 @@ describe Notify do
end
it 'has headers that reference an existing thread' do
+ is_expected.to have_header 'Message-ID', /<(.*)@#{Gitlab.config.gitlab.host}>/
is_expected.to have_header 'References', /<#{thread_id_prefix}(.*)@#{Gitlab.config.gitlab.host}>/
is_expected.to have_header 'In-Reply-To', /<#{thread_id_prefix}(.*)@#{Gitlab.config.gitlab.host}>/
is_expected.to have_header 'X-GitLab-Project', /#{project.name}/