summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-09-27 13:27:59 +0200
committerDouwe Maan <douwe@selenight.nl>2016-09-27 13:27:59 +0200
commit04d9547c4893338f084b83f8c2c11c5405cb36df (patch)
tree1f6db652b22612e4657247ac1fdc1f1e7f735563
parent1025b39058eec1b3a58cf8231edd6b2e3700ed22 (diff)
parent20de47235e39e585ac1c8746fc9c4f673da910a0 (diff)
downloadgitlab-ce-04d9547c4893338f084b83f8c2c11c5405cb36df.tar.gz
Merge branch 'fix-unsubscribe-header'
-rw-r--r--CHANGELOG1
-rw-r--r--app/mailers/notify.rb2
-rw-r--r--spec/features/unsubscribe_links_spec.rb2
-rw-r--r--spec/mailers/shared/notify.rb3
4 files changed, 5 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 5b08e8cd754..b3650079e48 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,7 @@ v 8.13.0 (unreleased)
v 8.12.2 (unreleased)
- Fix Import/Export not recognising correctly the imported services.
- Fix snippets pagination
+ - Fix List-Unsubscribe header in emails
v 8.12.1
- Fix a memory leak in HTML::Pipeline::SanitizationFilter::WHITELIST
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb
index 9799f1dc886..29f1c527776 100644
--- a/app/mailers/notify.rb
+++ b/app/mailers/notify.rb
@@ -109,7 +109,7 @@ class Notify < BaseMailer
headers['X-GitLab-Reply-Key'] = reply_key
if !@labels_url && @sent_notification && @sent_notification.unsubscribable?
- headers['List-Unsubscribe'] = unsubscribe_sent_notification_url(@sent_notification, force: true)
+ headers['List-Unsubscribe'] = "<#{unsubscribe_sent_notification_url(@sent_notification, force: true)}>"
@sent_notification_url = unsubscribe_sent_notification_url(@sent_notification)
end
diff --git a/spec/features/unsubscribe_links_spec.rb b/spec/features/unsubscribe_links_spec.rb
index cc40671787c..33b52d1547e 100644
--- a/spec/features/unsubscribe_links_spec.rb
+++ b/spec/features/unsubscribe_links_spec.rb
@@ -11,7 +11,7 @@ describe 'Unsubscribe links', feature: true do
let(:mail) { ActionMailer::Base.deliveries.last }
let(:body) { Capybara::Node::Simple.new(mail.default_part_body.to_s) }
- let(:header_link) { mail.header['List-Unsubscribe'] }
+ let(:header_link) { mail.header['List-Unsubscribe'].to_s[1..-2] } # Strip angle brackets
let(:body_link) { body.find_link('unsubscribe')['href'] }
before do
diff --git a/spec/mailers/shared/notify.rb b/spec/mailers/shared/notify.rb
index 56872da9a8f..5c9851f14c7 100644
--- a/spec/mailers/shared/notify.rb
+++ b/spec/mailers/shared/notify.rb
@@ -169,8 +169,9 @@ shared_examples 'it should show Gmail Actions View Commit link' do
end
shared_examples 'an unsubscribeable thread' do
- it 'has a List-Unsubscribe header' do
+ it 'has a List-Unsubscribe header in the correct format' do
is_expected.to have_header 'List-Unsubscribe', /unsubscribe/
+ is_expected.to have_header 'List-Unsubscribe', /^<.+>$/
end
it { is_expected.to have_body_text /unsubscribe/ }