Merge pull request #2860 from techAPJ/patch-2

include category in List-Id instead of topic
This commit is contained in:
Robin Ward
2014-10-08 15:28:41 -04:00
2 changed files with 21 additions and 7 deletions

View File

@ -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