FIX: List-ID should not contain space
This commit is contained in:
parent
717be06f17
commit
897563a309
|
@ -87,12 +87,12 @@ module Email
|
|||
|
||||
# http://www.ietf.org/rfc/rfc2919.txt
|
||||
if topic && topic.category && !topic.category.uncategorized?
|
||||
list_id = "<#{topic.category.name.downcase}.#{host}>"
|
||||
list_id = "<#{topic.category.name.downcase.split(' ').join('-')}.#{host}>"
|
||||
|
||||
# subcategory case
|
||||
if !topic.category.parent_category_id.nil?
|
||||
parent_category_name = Category.find_by(id: topic.category.parent_category_id).name
|
||||
list_id = "<#{topic.category.name.downcase}.#{parent_category_name.downcase}.#{host}>"
|
||||
list_id = "<#{topic.category.name.downcase.split(' ').join('-')}.#{parent_category_name.downcase.split(' ').join('-')}.#{host}>"
|
||||
end
|
||||
else
|
||||
list_id = "<#{host}>"
|
||||
|
|
|
@ -66,11 +66,14 @@ describe Email::Sender do
|
|||
|
||||
context "adds a List-ID header to identify the forum" do
|
||||
before do
|
||||
message.header['X-Discourse-Topic-Id'] = 5577
|
||||
category = Fabricate(:category, name: 'Name With Space')
|
||||
topic = Fabricate(:topic, category_id: category.id)
|
||||
message.header['X-Discourse-Topic-Id'] = topic.id
|
||||
end
|
||||
|
||||
When { email_sender.send }
|
||||
Then { expect(message.header['List-ID']).to be_present }
|
||||
Then { expect(message.header['List-ID'].to_s).to match('name-with-space') }
|
||||
end
|
||||
|
||||
context "adds a Message-ID header even when topic id is not present" do
|
||||
|
|
Loading…
Reference in New Issue