Remove unused translation fallback

This commit is contained in:
Benjamin Neff 2022-07-13 03:39:15 +02:00
parent a9ae84f3a6
commit 3c02a1f067
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
2 changed files with 1 additions and 37 deletions

View file

@ -7,11 +7,7 @@ module NotifierHelper
# @param opts [Hash] Optional hash. Accepts :length parameters. # @param opts [Hash] Optional hash. Accepts :length parameters.
# @return [String] The formatted post. # @return [String] The formatted post.
def post_message(post, opts={}) def post_message(post, opts={})
if post.respond_to? :message post.message&.plain_text_without_markdown.presence || post_page_title(post)
post.message.try(:plain_text_without_markdown).presence || post_page_title(post)
else
I18n.translate "notifier.a_post_you_shared"
end
end end
# @param comment [Comment] The comment to process. # @param comment [Comment] The comment to process.

View file

@ -121,10 +121,6 @@ describe Notifier, type: :mailer do
it "has the post text in the body" do it "has the post text in the body" do
expect(@mail.body.encoded).to include(@post.text) expect(@mail.body.encoded).to include(@post.text)
end end
it "should not include translation fallback" do
expect(@mail.body.encoded).not_to include(I18n.translate "notifier.a_post_you_shared")
end
end end
describe ".mentioned_in_comment" do describe ".mentioned_in_comment" do
@ -180,10 +176,6 @@ describe Notifier, type: :mailer do
it "has the post text not in the body" do it "has the post text not in the body" do
expect(@mail.body.encoded).not_to include(@post.text) expect(@mail.body.encoded).not_to include(@post.text)
end end
it "should not include translation fallback" do
expect(@mail.body.encoded).not_to include(I18n.translate "notifier.a_post_you_shared")
end
end end
describe ".liked" do describe ".liked" do
@ -205,10 +197,6 @@ describe Notifier, type: :mailer do
expect(@mail.body.encoded).to include(@like.author.name) expect(@mail.body.encoded).to include(@like.author.name)
end end
it "should not include translation fallback" do
expect(@mail.body.encoded).not_to include(I18n.translate "notifier.a_post_you_shared")
end
it "can handle a reshare" do it "can handle a reshare" do
reshare = FactoryGirl.create(:reshare) reshare = FactoryGirl.create(:reshare)
like = reshare.likes.create!(author: bob.person) like = reshare.likes.create!(author: bob.person)
@ -247,10 +235,6 @@ describe Notifier, type: :mailer do
it "BODY: contains the name of person liking" do it "BODY: contains the name of person liking" do
expect(@mail.body.encoded).to include(@reshare.author.name) expect(@mail.body.encoded).to include(@reshare.author.name)
end end
it "should not include translation fallback" do
expect(@mail.body.encoded).not_to include(I18n.translate "notifier.a_post_you_shared")
end
end end
describe ".private_message" do describe ".private_message" do
@ -294,10 +278,6 @@ describe Notifier, type: :mailer do
it "BODY: does not contain the message text" do it "BODY: does not contain the message text" do
expect(@mail.body.encoded).not_to include(@cnv.messages.first.text) expect(@mail.body.encoded).not_to include(@cnv.messages.first.text)
end end
it "should not include translation fallback" do
expect(@mail.body.encoded).not_to include(I18n.translate "notifier.a_post_you_shared")
end
end end
context "comments" do context "comments" do
@ -334,10 +314,6 @@ describe Notifier, type: :mailer do
it "contains the original post's link with comment anchor" do it "contains the original post's link with comment anchor" do
expect(comment_mail.body.encoded).to include("#{comment.post.id}##{comment.guid}") expect(comment_mail.body.encoded).to include("#{comment.post.id}##{comment.guid}")
end end
it "should not include translation fallback" do
expect(comment_mail.body.encoded).not_to include(I18n.translate "notifier.a_post_you_shared")
end
end end
[:reshare].each do |post_type| [:reshare].each do |post_type|
@ -380,10 +356,6 @@ describe Notifier, type: :mailer do
it "contains the original post's link with comment anchor" do it "contains the original post's link with comment anchor" do
expect(comment_mail.body.encoded).to include("#{comment.post.id}##{comment.guid}") expect(comment_mail.body.encoded).to include("#{comment.post.id}##{comment.guid}")
end end
it "should not include translation fallback" do
expect(comment_mail.body.encoded).not_to include(I18n.translate "notifier.a_post_you_shared")
end
end end
[:reshare].each do |post_type| [:reshare].each do |post_type|
context post_type.to_s do context post_type.to_s do
@ -490,10 +462,6 @@ describe Notifier, type: :mailer do
it "BODY: contains the name of person liking" do it "BODY: contains the name of person liking" do
expect(mail.body.encoded).to include(bob.name) expect(mail.body.encoded).to include(bob.name)
end end
it "should not include translation fallback" do
expect(mail.body.encoded).not_to include(I18n.translate "notifier.a_post_you_shared")
end
end end
end end