add threading headers to reply notifications

This commit is contained in:
Peter Bhat Harkins 2023-12-13 11:47:01 -06:00
parent 9500e23ef1
commit ff19562026
1 changed files with 10 additions and 0 deletions

View File

@ -12,6 +12,16 @@ class EmailReply < ApplicationMailer
@replied_to = @comment.parent_comment.user.username
end
# threading
headers "Message-Id" => @comment.mailing_list_message_id
if @comment.parent_comment.present?
headers "In-Reply-To" => @comment.parent_comment.mailing_list_message_id
end
headers "References" => (
([@comment.story.mailing_list_message_id] + @comment.parents.map(&:mailing_list_message_id))
.map { |r| "<#{r}>" }
)
mail(
to: user.email,
subject: "[#{Rails.application.name}] Reply from " \