Add In-Reply-To and References headers to notification mails
closes #7122
This commit is contained in:
parent
6ca598e54a
commit
dfb5b717b6
8 changed files with 38 additions and 1 deletions
|
|
@ -37,6 +37,7 @@ Note: Although this is a minor release, the configuration file changed because t
|
|||
* Add support for setting BOSH access protocol via chat configuration [#7100](https://github.com/diaspora/diaspora/pull/7100)
|
||||
* Add number of unreviewed reports to admin dashboard and admin sidebar [#7109](https://github.com/diaspora/diaspora/pull/7109)
|
||||
* Don't federate to pods that have been offline for an extended period of time [#7120](https://github.com/diaspora/diaspora/pull/7120)
|
||||
* Add In-Reply-To and References headers to notification mails [#7122](https://github.com/diaspora/diaspora/pull/7122)
|
||||
|
||||
# 0.6.0.1
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ module NotificationMailers
|
|||
|
||||
if mail?
|
||||
@headers[:from] = "\"#{@comment.author_name} (diaspora*)\" <#{AppConfig.mail.sender_address}>"
|
||||
@headers[:in_reply_to] = @headers[:references] = "<#{@comment.parent.guid}@#{AppConfig.pod_uri.host}>"
|
||||
if @comment.public?
|
||||
@headers[:subject] = "Re: #{@comment.comment_email_subject}"
|
||||
else
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ module NotificationMailers
|
|||
@comment = Comment.find(comment_id)
|
||||
|
||||
@headers[:from] = "\"#{@comment.author_name} (diaspora*)\" <#{AppConfig.mail.sender_address}>"
|
||||
@headers[:in_reply_to] = @headers[:references] = "<#{@comment.parent.guid}@#{AppConfig.pod_uri.host}>"
|
||||
if @comment.public?
|
||||
@headers[:subject] = "Re: #{@comment.comment_email_subject}"
|
||||
else
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ module NotificationMailers
|
|||
@like = Like.find(like_id)
|
||||
|
||||
@headers[:subject] = I18n.t('notifier.liked.liked', :name => @sender.name)
|
||||
@headers[:in_reply_to] = @headers[:references] = "<#{@like.parent.guid}@#{AppConfig.pod_uri.host}>"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ module NotificationMailers
|
|||
@post = Mention.find_by_id(target_id).post
|
||||
|
||||
@headers[:subject] = I18n.t('notifier.mentioned.subject', :name => @sender.name)
|
||||
@headers[:in_reply_to] = @headers[:references] = "<#{@post.guid}@#{AppConfig.pod_uri.host}>"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ module NotificationMailers
|
|||
|
||||
@headers[:from] = "\"#{@message.author_name} (diaspora*)\" <#{AppConfig.mail.sender_address}>"
|
||||
@headers[:subject] = I18n.t("notifier.private_message.subject")
|
||||
@headers[:in_reply_to] = @headers[:references] = "<#{@conversation.guid}@#{AppConfig.pod_uri.host}>"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
module NotificationMailers
|
||||
class Reshared < NotificationMailers::Base
|
||||
attr_accessor :reshare
|
||||
|
||||
|
||||
delegate :root, to: :reshare, prefix: true
|
||||
|
||||
def set_headers(reshare_id)
|
||||
@reshare = Reshare.find(reshare_id)
|
||||
|
||||
@headers[:subject] = I18n.t('notifier.reshared.reshared', :name => @sender.name)
|
||||
@headers[:in_reply_to] = @headers[:references] = "<#{@reshare.root_guid}@#{AppConfig.pod_uri.host}>"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -94,6 +94,11 @@ describe Notifier, type: :mailer do
|
|||
expect(@mail.subject).to include(@post.author.name)
|
||||
end
|
||||
|
||||
it "IN-REPLY-TO and REFERENCES: references the mentioning post" do
|
||||
expect(@mail.in_reply_to).to eq("#{@post.guid}@#{AppConfig.pod_uri.host}")
|
||||
expect(@mail.references).to eq("#{@post.guid}@#{AppConfig.pod_uri.host}")
|
||||
end
|
||||
|
||||
it "has the post text in the body" do
|
||||
expect(@mail.body.encoded).to include(@post.text)
|
||||
end
|
||||
|
|
@ -170,6 +175,11 @@ describe Notifier, type: :mailer do
|
|||
expect(@mail.to).to eq([alice.email])
|
||||
end
|
||||
|
||||
it "IN-REPLY-TO and REFERENCES: references the reshared post" do
|
||||
expect(@mail.in_reply_to).to eq("#{@post.guid}@#{AppConfig.pod_uri.host}")
|
||||
expect(@mail.references).to eq("#{@post.guid}@#{AppConfig.pod_uri.host}")
|
||||
end
|
||||
|
||||
it "BODY: contains the truncated original post" do
|
||||
expect(@mail.body.encoded).to include(@post.message.plain_text)
|
||||
end
|
||||
|
|
@ -216,6 +226,11 @@ describe Notifier, type: :mailer do
|
|||
expect(@mail.subject).not_to include(@cnv.subject)
|
||||
end
|
||||
|
||||
it "IN-REPLY-TO and REFERENCES: references the containing conversation" do
|
||||
expect(@mail.in_reply_to).to eq("#{@cnv.guid}@#{AppConfig.pod_uri.host}")
|
||||
expect(@mail.references).to eq("#{@cnv.guid}@#{AppConfig.pod_uri.host}")
|
||||
end
|
||||
|
||||
it "BODY: does not contain the message text" do
|
||||
expect(@mail.body.encoded).not_to include(@cnv.messages.first.text)
|
||||
end
|
||||
|
|
@ -290,6 +305,11 @@ describe Notifier, type: :mailer do
|
|||
expect(comment_mail.subject).to eq("Re: Headline")
|
||||
end
|
||||
|
||||
it "IN-REPLY-TO and REFERENCES: references the commented post" do
|
||||
expect(comment_mail.in_reply_to).to eq("#{comment.parent.guid}@#{AppConfig.pod_uri.host}")
|
||||
expect(comment_mail.references).to eq("#{comment.parent.guid}@#{AppConfig.pod_uri.host}")
|
||||
end
|
||||
|
||||
context "BODY" do
|
||||
it "contains the comment" do
|
||||
expect(comment_mail.body.encoded).to include(comment.text)
|
||||
|
|
@ -365,6 +385,11 @@ describe Notifier, type: :mailer do
|
|||
expect(mail.subject).not_to include("Limited headline")
|
||||
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 "BODY: does not show the limited post" do
|
||||
expect(mail.body.encoded).not_to include("Limited headline")
|
||||
end
|
||||
|
|
@ -391,6 +416,11 @@ describe Notifier, type: :mailer do
|
|||
expect(mail.subject).not_to include("Limited headline")
|
||||
end
|
||||
|
||||
it "IN-REPLY-TO and REFERENCES: references the liked post" do
|
||||
expect(mail.in_reply_to).to eq("#{like.parent.guid}@#{AppConfig.pod_uri.host}")
|
||||
expect(mail.references).to eq("#{like.parent.guid}@#{AppConfig.pod_uri.host}")
|
||||
end
|
||||
|
||||
it "BODY: does not show the limited post" do
|
||||
expect(mail.body.encoded).not_to include("Limited headline")
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue