issue-6850 Don't include subjects of private messages in email notifications

This commit is contained in:
SaiVardhan 2016-07-08 16:03:52 +05:30
parent 053f69b67c
commit 274104aac6
3 changed files with 6 additions and 9 deletions

View file

@ -8,8 +8,7 @@ module NotificationMailers
@participants = @conversation.participants @participants = @conversation.participants
@headers[:from] = "\"#{@message.author_name} (diaspora*)\" <#{AppConfig.mail.sender_address}>" @headers[:from] = "\"#{@message.author_name} (diaspora*)\" <#{AppConfig.mail.sender_address}>"
@headers[:subject] = @conversation.subject.strip @headers[:subject] = I18n.t("notifier.private_message.subject")
@headers[:subject] = "Re: #{@headers[:subject]}" if @conversation.messages.size > 1
end end
end end
end end

View file

@ -683,6 +683,7 @@ en:
subject: "%{name} has mentioned you on diaspora*" subject: "%{name} has mentioned you on diaspora*"
limited_post: "You were mentioned in a limited post." limited_post: "You were mentioned in a limited post."
private_message: private_message:
subject: "Theres a new private message for you"
reply_to_or_view: "Reply to or view this conversation >" reply_to_or_view: "Reply to or view this conversation >"
liked: liked:
liked: "%{name} liked your post" liked: "%{name} liked your post"

View file

@ -212,15 +212,12 @@ describe Notifier, type: :mailer do
expect(@mail["From"].to_s).to eq("\"#{@cnv.author.name} (diaspora*)\" <#{AppConfig.mail.sender_address}>") expect(@mail["From"].to_s).to eq("\"#{@cnv.author.name} (diaspora*)\" <#{AppConfig.mail.sender_address}>")
end end
it "SUBJECT: has a snippet of the post contents" do it "should use a generic subject" do
expect(@mail.subject).to eq(@cnv.subject) expect(@mail.subject).to eq(I18n.translate("notifier.private_message.subject"))
end end
it "SUBJECT: has 'Re:' if not the first message in a conversation" do it "SUBJECT: should not has a snippet of the private message contents" do
@cnv.messages << Message.new(text: "yo", author: eve.person) expect(@mail.subject).not_to eq(@cnv.subject)
@mail = Notifier.private_message(bob.id, @cnv.author.id, @cnv.messages.last.id)
expect(@mail.subject).to eq("Re: #{@cnv.subject}")
end end
it "BODY: does not contain the message text" do it "BODY: does not contain the message text" do