A platform for community discussion. Free, open, simple.
UX: improve sender name in emails (#36974)
David Battersby826d3463945f
diff --git a/app/mailers/group_smtp_mailer.rb b/app/mailers/group_smtp_mailer.rbindex 3b2b0ee8f1b..dd146f7384c 100644--- a/app/mailers/group_smtp_mailer.rb+++ b/app/mailers/group_smtp_mailer.rb@@ -49,7 +49,7 @@ class GroupSmtpMailer < ActionMailer::Baselocale: SiteSetting.default_locale,delivery_method_options: delivery_options,from: from_group.smtp_from_address,- from_alias: I18n.t("email_from_without_site", group_name: group_name),+ from_alias: group_name,html_override: html_override(post),cc: cc_addresses,bcc: bcc_addresses,diff --git a/app/mailers/user_notifications.rb b/app/mailers/user_notifications.rbindex cad8b658d4e..f5cc9b0cc82 100644--- a/app/mailers/user_notifications.rb+++ b/app/mailers/user_notifications.rb@@ -555,7 +555,7 @@ class UserNotifications < ActionMailer::Basetitle: topic_title,post: post,username: original_username,- from_alias: I18n.t("email_from", user_name: user_name, site_name: Email.site_title),+ from_alias: user_name,allow_reply_by_email: allow_reply_by_email,use_site_subject: opts[:use_site_subject],add_re_to_subject: opts[:add_re_to_subject],diff --git a/config/locales/server.en.yml b/config/locales/server.en.ymlindex 18689a4c4b0..64fd20903dd 100644--- a/config/locales/server.en.yml+++ b/config/locales/server.en.yml@@ -4118,8 +4118,6 @@ en:subject_re: "Re: "subject_pm: "[PM] "- email_from: "%{user_name} via %{site_name}"- email_from_without_site: "%{group_name}"user_notifications:previous_discussion: "Previous Replies"diff --git a/spec/mailers/user_notifications_spec.rb b/spec/mailers/user_notifications_spec.rbindex b87ca0ed886..86a383d7045 100644--- a/spec/mailers/user_notifications_spec.rb+++ b/spec/mailers/user_notifications_spec.rb@@ -520,7 +520,7 @@ RSpec.describe UserNotifications do)# from should include full user name- expect(mail[:from].display_names).to eql(["John Doe via Discourse"])+ expect(mail[:from].display_names).to eql(["John Doe"])# subject should include category nameexpect(mail.subject).to match(/India/)@@ -750,7 +750,7 @@ RSpec.describe UserNotifications doexpect(mail[:from].display_names).to_not eql(["John Doe"])# from should include username if "show user full names" is disabled- expect(mail[:from].display_names).to eql(["john via Discourse"])+ expect(mail[:from].display_names).to eql(["john"])# subject should not include category nameexpect(mail.subject).not_to match(/Uncategorized/)@@ -842,7 +842,7 @@ RSpec.describe UserNotifications do)# from should include username if full user name is not provided- expect(mail[:from].display_names).to eql(["john via Discourse"])+ expect(mail[:from].display_names).to eql(["john"])# subject should include "[PM]"expect(mail.subject).to include("[PM] ")@@ -1156,13 +1156,13 @@ RSpec.describe UserNotifications doit "should have user name as from_alias" doSiteSetting.enable_names = trueSiteSetting.display_name_on_posts = true- expects_build_with(has_entry(:from_alias, "#{user.name} via Discourse"))+ expects_build_with(has_entry(:from_alias, user.name))endit "should not have user name as from_alias if display_name_on_posts is disabled" doSiteSetting.enable_names = falseSiteSetting.display_name_on_posts = false- expects_build_with(has_entry(:from_alias, "walterwhite via Discourse"))+ expects_build_with(has_entry(:from_alias, "walterwhite"))endit "should explain how to respond" do@@ -1332,13 +1332,13 @@ RSpec.describe UserNotifications doSiteSetting.enable_names = falseexpect(mailer.message.to_s).to include(- "From: #{inviter.username} via #{SiteSetting.title} <#{SiteSetting.notification_email}>",+ "From: #{inviter.username} <#{SiteSetting.notification_email}>",)endit "sends the email as the inviter" doexpect(mailer.message.to_s).to include(- "From: #{inviter.name} via #{SiteSetting.title} <#{SiteSetting.notification_email}>",+ "From: #{inviter.name} <#{SiteSetting.notification_email}>",)endend