Add In-Reply-To and References header to mentioned in comment mail

This commit is contained in:
Benjamin Neff 2017-02-16 01:45:13 +01:00
parent f1f1d09944
commit 97c351c7b4
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
2 changed files with 6 additions and 0 deletions

View file

@ -5,6 +5,7 @@ module NotificationMailers
def set_headers(target_id) # rubocop:disable Style/AccessorMethodName def set_headers(target_id) # rubocop:disable Style/AccessorMethodName
@comment = Mention.find_by_id(target_id).mentions_container @comment = Mention.find_by_id(target_id).mentions_container
@headers[:in_reply_to] = @headers[:references] = "<#{@comment.parent.guid}@#{AppConfig.pod_uri.host}>"
@headers[:subject] = I18n.t("notifier.mentioned.subject", name: @sender.name) @headers[:subject] = I18n.t("notifier.mentioned.subject", name: @sender.name)
end end
end end

View file

@ -120,6 +120,11 @@ describe Notifier, type: :mailer do
expect(mail.subject).to include(comment.author.name) expect(mail.subject).to include(comment.author.name)
end end
it "IN-REPLY-TO and REFERENCES: references the commented post" do
expect(mail.in_reply_to).to eq("#{comment.parent.guid}@#{AppConfig.pod_uri.host}")
expect(mail.references).to eq("#{comment.parent.guid}@#{AppConfig.pod_uri.host}")
end
it "has the comment link in the body" do it "has the comment link in the body" do
expect(mail.body.encoded).to include(post_url(comment.parent, anchor: comment.guid)) expect(mail.body.encoded).to include(post_url(comment.parent, anchor: comment.guid))
end end