From 47d48b4dd88823a63a5892a96b326112103a323d Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 9 Oct 2014 01:27:30 +0530 Subject: [PATCH] FEATURE: add Precedence header --- lib/email/sender.rb | 3 +++ spec/components/email/sender_spec.rb | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/email/sender.rb b/lib/email/sender.rb index aeaff6bdd1c..bc16b2bf98c 100644 --- a/lib/email/sender.rb +++ b/lib/email/sender.rb @@ -87,6 +87,9 @@ module Email @message.header['List-ID'] = list_id @message.header['List-Archive'] = topic.url if topic + + # http://www.ietf.org/rfc/rfc3834.txt + @message.header['Precedence'] = 'list' end if reply_key.present? diff --git a/spec/components/email/sender_spec.rb b/spec/components/email/sender_spec.rb index 939a4fc092f..3853f82ca15 100644 --- a/spec/components/email/sender_spec.rb +++ b/spec/components/email/sender_spec.rb @@ -73,6 +73,15 @@ describe Email::Sender do Then { expect(message.header['List-ID']).to be_present } end + context "adds Precedence header" do + before do + message.header['X-Discourse-Topic-Id'] = 5577 + end + + When { email_sender.send } + Then { expect(message.header['Precedence']).to be_present } + end + context 'email logs' do let(:email_log) { EmailLog.last }