diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index c0d15c96ced..0a3c7f5435e 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -819,7 +819,7 @@ en: email_in: "Allow users to post new topics via email" email_in_address: "The email address the users can post new topics to. None means users can't post globally." email_in_min_trust: "The minimum trust level an users needs to have to be allowed to post new topics via email" - email_in_category: "The category new emails are posted into" + email_prefix: "The [label] used in the subject of emails. It will default to 'title' if not set" minimum_topics_similar: "How many topics need to exist in the database before similar topics are presented." diff --git a/config/site_settings.yml b/config/site_settings.yml index 1e77b9acda8..aa0d320dd64 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -269,6 +269,7 @@ email: default: 3 enum: 'MinTrustToCreateTopicSetting' email_in_category: -1 + email_prefix: '' files: max_image_size_kb: diff --git a/lib/email/message_builder.rb b/lib/email/message_builder.rb index 8cb268a3e3e..6a85fa07597 100644 --- a/lib/email/message_builder.rb +++ b/lib/email/message_builder.rb @@ -21,7 +21,7 @@ module Email @to = to @opts = opts || {} - @template_args = {site_name: SiteSetting.title, + @template_args = {site_name: SiteSetting.email_prefix.presence || SiteSetting.title, base_url: Discourse.base_url, user_preferences_url: "#{Discourse.base_url}/user_preferences" }.merge!(@opts) diff --git a/spec/components/email/message_builder_spec.rb b/spec/components/email/message_builder_spec.rb index 3e1310e63a3..e165b760258 100644 --- a/spec/components/email/message_builder_spec.rb +++ b/spec/components/email/message_builder_spec.rb @@ -145,10 +145,15 @@ describe Email::MessageBuilder do context "template_args" do let(:template_args) { builder.template_args } - it "has the site name" do + it "has the site name as the site title when `SiteSetting.email_prefix` is not set" do expect(template_args[:site_name]).to eq(SiteSetting.title) end + it "has the site name as SiteSetting.email_prefix when it is set" do + SiteSetting.email_prefix = 'some email prefix' + expect(template_args[:site_name]).to eq(SiteSetting.email_prefix) + end + it "has the base url" do expect(template_args[:base_url]).to eq(Discourse.base_url) end