mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 01:05:11 +08:00
Merge pull request #2860 from techAPJ/patch-2
include category in List-Id instead of topic
This commit is contained in:
@ -70,11 +70,22 @@ module Email
|
||||
@message.header['In-Reply-To'] = topic_identifier
|
||||
@message.header['References'] = topic_identifier
|
||||
|
||||
topic = Topic.where(id: topic_id).first
|
||||
|
||||
# http://www.ietf.org/rfc/rfc2919.txt
|
||||
list_id = "<topic.#{topic_id}.#{host}>"
|
||||
if topic && topic.category && !topic.category.uncategorized?
|
||||
list_id = "<#{topic.category.name.downcase}.#{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}>"
|
||||
end
|
||||
else
|
||||
list_id = "<#{host}>"
|
||||
end
|
||||
@message.header['List-ID'] = list_id
|
||||
|
||||
topic = Topic.where(id: topic_id).first
|
||||
@message.header['List-Archive'] = topic.url if topic
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user