Merge pull request #4774 from techAPJ/email-prefix

FIX: use email prefix only in subject
This commit is contained in:
Arpit Jalan 2017-03-22 14:18:50 +05:30 committed by GitHub
commit 786fd6bbd2
4 changed files with 58 additions and 57 deletions

View File

@ -87,7 +87,7 @@ class UserNotifications < ActionMailer::Base
build_summary_for(user) build_summary_for(user)
opts = { opts = {
from_alias: I18n.t('user_notifications.mailing_list.from', site_name: SiteSetting.title), from_alias: I18n.t('user_notifications.mailing_list.from', site_name: SiteSetting.title),
subject: I18n.t('user_notifications.mailing_list.subject_template', site_name: @site_name, date: @date), subject: I18n.t('user_notifications.mailing_list.subject_template', email_prefix: @email_prefix, date: @date),
mailing_list_mode: true, mailing_list_mode: true,
add_unsubscribe_link: true, add_unsubscribe_link: true,
unsubscribe_url: "#{Discourse.base_url}/email/unsubscribe/#{@unsubscribe_key}", unsubscribe_url: "#{Discourse.base_url}/email/unsubscribe/#{@unsubscribe_key}",
@ -167,7 +167,7 @@ class UserNotifications < ActionMailer::Base
opts = { opts = {
from_alias: I18n.t('user_notifications.digest.from', site_name: SiteSetting.title), from_alias: I18n.t('user_notifications.digest.from', site_name: SiteSetting.title),
subject: I18n.t('user_notifications.digest.subject_template', site_name: @site_name, date: short_date(Time.now)), subject: I18n.t('user_notifications.digest.subject_template', email_prefix: @email_prefix, date: short_date(Time.now)),
add_unsubscribe_link: true, add_unsubscribe_link: true,
unsubscribe_url: "#{Discourse.base_url}/email/unsubscribe/#{@unsubscribe_key}", unsubscribe_url: "#{Discourse.base_url}/email/unsubscribe/#{@unsubscribe_key}",
} }
@ -478,7 +478,7 @@ class UserNotifications < ActionMailer::Base
@user = user @user = user
@date = short_date(Time.now) @date = short_date(Time.now)
@base_url = Discourse.base_url @base_url = Discourse.base_url
@site_name = SiteSetting.email_prefix.presence || SiteSetting.title @email_prefix = SiteSetting.email_prefix.presence || SiteSetting.title
@header_color = ColorScheme.hex_for_name('header_primary') @header_color = ColorScheme.hex_for_name('header_primary')
@header_bgcolor = ColorScheme.hex_for_name('header_background') @header_bgcolor = ColorScheme.hex_for_name('header_background')
@anchor_color = ColorScheme.hex_for_name('tertiary') @anchor_color = ColorScheme.hex_for_name('tertiary')

View File

@ -1777,7 +1777,7 @@ en:
download_backup_mailer: download_backup_mailer:
title: "Download Backup Mailer" title: "Download Backup Mailer"
subject_template: "[%{site_name}] Site Backup Download" subject_template: "[%{email_prefix}] Site Backup Download"
text_body_template: | text_body_template: |
Here's the [site backup download](%{backup_file_path}) you requested. Here's the [site backup download](%{backup_file_path}) you requested.
@ -1789,7 +1789,7 @@ en:
test_mailer: test_mailer:
title: "Test Mailer" title: "Test Mailer"
subject_template: "[%{site_name}] Email Deliverability Test" subject_template: "[%{email_prefix}] Email Deliverability Test"
text_body_template: | text_body_template: |
This is a test email from This is a test email from
@ -1834,7 +1834,7 @@ en:
new_version_mailer: new_version_mailer:
title: "New Version Mailer" title: "New Version Mailer"
subject_template: "[%{site_name}] New Discourse version, update available" subject_template: "[%{email_prefix}] New Discourse version, update available"
text_body_template: | text_body_template: |
Hooray, a new version of [Discourse](http://www.discourse.org) is available! Hooray, a new version of [Discourse](http://www.discourse.org) is available!
@ -1849,7 +1849,7 @@ en:
new_version_mailer_with_notes: new_version_mailer_with_notes:
title: "New Version Mailer with Notes" title: "New Version Mailer with Notes"
subject_template: "[%{site_name}] update available" subject_template: "[%{email_prefix}] update available"
text_body_template: | text_body_template: |
Hooray, a new version of [Discourse](http://www.discourse.org) is available! Hooray, a new version of [Discourse](http://www.discourse.org) is available!
@ -1869,8 +1869,8 @@ en:
queued_posts_reminder: queued_posts_reminder:
title: "Queued Posts Reminder" title: "Queued Posts Reminder"
subject_template: subject_template:
one: "[%{site_name}] 1 post waiting to be reviewed" one: "[%{email_prefix}] 1 post waiting to be reviewed"
other: "[%{site_name}] %{count} posts waiting to be reviewed" other: "[%{email_prefix}] %{count} posts waiting to be reviewed"
text_body_template: | text_body_template: |
Hello, Hello,
@ -2036,7 +2036,7 @@ en:
email_reject_insufficient_trust_level: email_reject_insufficient_trust_level:
title: "Email Reject insufficient Trust Level" title: "Email Reject insufficient Trust Level"
subject_template: "[%{site_name}] Email issue -- Insufficient Trust Level" subject_template: "[%{email_prefix}] Email issue -- Insufficient Trust Level"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2044,7 +2044,7 @@ en:
email_reject_user_not_found: email_reject_user_not_found:
title: "Email Reject User Not Found" title: "Email Reject User Not Found"
subject_template: "[%{site_name}] Email issue -- User Not Found" subject_template: "[%{email_prefix}] Email issue -- User Not Found"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2052,7 +2052,7 @@ en:
email_reject_screened_email: email_reject_screened_email:
title: "Email Reject Screened Email" title: "Email Reject Screened Email"
subject_template: "[%{site_name}] Email issue -- Blocked Email" subject_template: "[%{email_prefix}] Email issue -- Blocked Email"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2060,7 +2060,7 @@ en:
email_reject_inactive_user: email_reject_inactive_user:
title: "Email Reject Inactive User" title: "Email Reject Inactive User"
subject_template: "[%{site_name}] Email issue -- Inactive User" subject_template: "[%{email_prefix}] Email issue -- Inactive User"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2068,7 +2068,7 @@ en:
email_reject_blocked_user: email_reject_blocked_user:
title: "Email Reject Blocked User" title: "Email Reject Blocked User"
subject_template: "[%{site_name}] Email issue -- Blocked User" subject_template: "[%{email_prefix}] Email issue -- Blocked User"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2076,7 +2076,7 @@ en:
email_reject_reply_user_not_matching: email_reject_reply_user_not_matching:
title: "Email Reject User Not Matching" title: "Email Reject User Not Matching"
subject_template: "[%{site_name}] Email issue -- Unexpected Reply Address" subject_template: "[%{email_prefix}] Email issue -- Unexpected Reply Address"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2084,7 +2084,7 @@ en:
email_reject_no_account: email_reject_no_account:
title: "Email Reject No Account" title: "Email Reject No Account"
subject_template: "[%{site_name}] Email issue -- Unknown Account" subject_template: "[%{email_prefix}] Email issue -- Unknown Account"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2092,7 +2092,7 @@ en:
email_reject_empty: email_reject_empty:
title: "Email Reject Empty" title: "Email Reject Empty"
subject_template: "[%{site_name}] Email issue -- No Content" subject_template: "[%{email_prefix}] Email issue -- No Content"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2102,7 +2102,7 @@ en:
email_reject_parsing: email_reject_parsing:
title: "Email Reject Parsing" title: "Email Reject Parsing"
subject_template: "[%{site_name}] Email issue -- Content Unrecognized" subject_template: "[%{email_prefix}] Email issue -- Content Unrecognized"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2110,7 +2110,7 @@ en:
email_reject_invalid_access: email_reject_invalid_access:
title: "Email Reject Invalid Access" title: "Email Reject Invalid Access"
subject_template: "[%{site_name}] Email issue -- Invalid Access" subject_template: "[%{email_prefix}] Email issue -- Invalid Access"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2118,7 +2118,7 @@ en:
email_reject_strangers_not_allowed: email_reject_strangers_not_allowed:
title: "Email Reject Strangers Not Allowed" title: "Email Reject Strangers Not Allowed"
subject_template: "[%{site_name}] Email issue -- Invalid Access" subject_template: "[%{email_prefix}] Email issue -- Invalid Access"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2126,7 +2126,7 @@ en:
email_reject_invalid_post: email_reject_invalid_post:
title: "Email Reject Invalid Post" title: "Email Reject Invalid Post"
subject_template: "[%{site_name}] Email issue -- Posting error" subject_template: "[%{email_prefix}] Email issue -- Posting error"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2134,7 +2134,7 @@ en:
email_reject_invalid_post_specified: email_reject_invalid_post_specified:
title: "Email Reject Invalid Post Specified" title: "Email Reject Invalid Post Specified"
subject_template: "[%{site_name}] Email issue -- Posting error" subject_template: "[%{email_prefix}] Email issue -- Posting error"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2146,7 +2146,7 @@ en:
email_reject_invalid_post_action: email_reject_invalid_post_action:
title: "Email Reject Invalid Post Action" title: "Email Reject Invalid Post Action"
subject_template: "[%{site_name}] Email issue -- Invalid Post Action" subject_template: "[%{email_prefix}] Email issue -- Invalid Post Action"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2155,7 +2155,7 @@ en:
email_reject_reply_key: email_reject_reply_key:
title: "Email Reject Reply Key" title: "Email Reject Reply Key"
subject_template: "[%{site_name}] Email issue -- Unknown Reply Key" subject_template: "[%{email_prefix}] Email issue -- Unknown Reply Key"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2163,7 +2163,7 @@ en:
email_reject_bad_destination_address: email_reject_bad_destination_address:
title: "Email Reject Bad Destination Address" title: "Email Reject Bad Destination Address"
subject_template: "[%{site_name}] Email issue -- Unknown To: Address" subject_template: "[%{email_prefix}] Email issue -- Unknown To: Address"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2171,7 +2171,7 @@ en:
email_reject_topic_not_found: email_reject_topic_not_found:
title: "Email Reject Topic Not Found" title: "Email Reject Topic Not Found"
subject_template: "[%{site_name}] Email issue -- Topic Not Found" subject_template: "[%{email_prefix}] Email issue -- Topic Not Found"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2179,7 +2179,7 @@ en:
email_reject_topic_closed: email_reject_topic_closed:
title: "Email Reject Topic Closed" title: "Email Reject Topic Closed"
subject_template: "[%{site_name}] Email issue -- Topic Closed" subject_template: "[%{email_prefix}] Email issue -- Topic Closed"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2187,7 +2187,7 @@ en:
email_reject_auto_generated: email_reject_auto_generated:
title: "Email Reject Auto Generated" title: "Email Reject Auto Generated"
subject_template: "[%{site_name}] Email issue -- Auto Generated Reply" subject_template: "[%{email_prefix}] Email issue -- Auto Generated Reply"
text_body_template: | text_body_template: |
We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work. We're sorry, but your email message to %{destination} (titled %{former_title}) didn't work.
@ -2195,7 +2195,7 @@ en:
email_error_notification: email_error_notification:
title: "Email Error Notification" title: "Email Error Notification"
subject_template: "[%{site_name}] Email issue -- POP authentication error" subject_template: "[%{email_prefix}] Email issue -- POP authentication error"
text_body_template: | text_body_template: |
Unfortunately, there was an authentication error while polling mails from the POP server. Unfortunately, there was an authentication error while polling mails from the POP server.
@ -2350,7 +2350,7 @@ en:
user_invited_to_private_message_pm: user_invited_to_private_message_pm:
title: "User Invited to PM" title: "User Invited to PM"
subject_template: "[%{site_name}] %{username} invited you to a message '%{topic_title}'" subject_template: "[%{email_prefix}] %{username} invited you to a message '%{topic_title}'"
text_body_template: | text_body_template: |
%{header_instructions} %{header_instructions}
@ -2360,7 +2360,7 @@ en:
user_invited_to_private_message_pm_staged: user_invited_to_private_message_pm_staged:
title: "User Invited to PM Staged" title: "User Invited to PM Staged"
subject_template: "[%{site_name}] %{username} invited you to a message '%{topic_title}'" subject_template: "[%{email_prefix}] %{username} invited you to a message '%{topic_title}'"
text_body_template: | text_body_template: |
%{header_instructions} %{header_instructions}
@ -2370,7 +2370,7 @@ en:
user_invited_to_topic: user_invited_to_topic:
title: "User Invited to Topic" title: "User Invited to Topic"
subject_template: "[%{site_name}] %{username} invited you to '%{topic_title}'" subject_template: "[%{email_prefix}] %{username} invited you to '%{topic_title}'"
text_body_template: | text_body_template: |
%{header_instructions} %{header_instructions}
@ -2380,7 +2380,7 @@ en:
user_replied: user_replied:
title: "User Replied" title: "User Replied"
subject_template: "[%{site_name}] %{topic_title}" subject_template: "[%{email_prefix}] %{topic_title}"
text_body_template: | text_body_template: |
%{header_instructions} %{header_instructions}
@ -2392,7 +2392,7 @@ en:
user_replied_pm: user_replied_pm:
title: "User Replied PM" title: "User Replied PM"
subject_template: "[%{site_name}] [PM] %{topic_title}" subject_template: "[%{email_prefix}] [PM] %{topic_title}"
text_body_template: | text_body_template: |
%{header_instructions} %{header_instructions}
@ -2404,7 +2404,7 @@ en:
user_quoted: user_quoted:
title: "User Quoted" title: "User Quoted"
subject_template: "[%{site_name}] %{topic_title}" subject_template: "[%{email_prefix}] %{topic_title}"
text_body_template: | text_body_template: |
%{header_instructions} %{header_instructions}
@ -2416,7 +2416,7 @@ en:
user_linked: user_linked:
title: "User Linked" title: "User Linked"
subject_template: "[%{site_name}] %{topic_title}" subject_template: "[%{email_prefix}] %{topic_title}"
text_body_template: | text_body_template: |
%{header_instructions} %{header_instructions}
@ -2428,7 +2428,7 @@ en:
user_mentioned: user_mentioned:
title: "User Mentioned" title: "User Mentioned"
subject_template: "[%{site_name}] %{topic_title}" subject_template: "[%{email_prefix}] %{topic_title}"
text_body_template: | text_body_template: |
%{header_instructions} %{header_instructions}
@ -2440,7 +2440,7 @@ en:
user_group_mentioned: user_group_mentioned:
title: "User Group Mentioned" title: "User Group Mentioned"
subject_template: "[%{site_name}] %{topic_title}" subject_template: "[%{email_prefix}] %{topic_title}"
text_body_template: | text_body_template: |
%{header_instructions} %{header_instructions}
@ -2452,7 +2452,7 @@ en:
user_posted: user_posted:
title: "User Posted" title: "User Posted"
subject_template: "[%{site_name}] %{topic_title}" subject_template: "[%{email_prefix}] %{topic_title}"
text_body_template: | text_body_template: |
%{header_instructions} %{header_instructions}
@ -2464,7 +2464,7 @@ en:
user_watching_first_post: user_watching_first_post:
title: "User Watching First Post" title: "User Watching First Post"
subject_template: "[%{site_name}] %{topic_title}" subject_template: "[%{email_prefix}] %{topic_title}"
text_body_template: | text_body_template: |
%{header_instructions} %{header_instructions}
@ -2476,7 +2476,7 @@ en:
user_posted_pm: user_posted_pm:
title: "User Posted PM" title: "User Posted PM"
subject_template: "[%{site_name}] [PM] %{topic_title}" subject_template: "[%{email_prefix}] [PM] %{topic_title}"
text_body_template: | text_body_template: |
%{header_instructions} %{header_instructions}
@ -2507,7 +2507,7 @@ en:
join_the_discussion: "Read More" join_the_discussion: "Read More"
popular_posts: "Popular Posts" popular_posts: "Popular Posts"
more_new: "New for you" more_new: "New for you"
subject_template: "[%{site_name}] Summary" subject_template: "[%{email_prefix}] Summary"
unsubscribe: "This summary is sent from %{site_link} when we haven't seen you in a while. To unsubscribe %{unsubscribe_link}." unsubscribe: "This summary is sent from %{site_link} when we haven't seen you in a while. To unsubscribe %{unsubscribe_link}."
click_here: "click here" click_here: "click here"
from: "%{site_name} summary" from: "%{site_name} summary"
@ -2537,7 +2537,7 @@ en:
mailing_list: mailing_list:
why: "All activity on %{site_link} for %{date}" why: "All activity on %{site_link} for %{date}"
subject_template: "[%{site_name}] Summary for %{date}" subject_template: "[%{email_prefix}] Summary for %{date}"
unsubscribe: "This summary is sent daily due to mailing list mode being enabled. To unsubscribe %{unsubscribe_link}." unsubscribe: "This summary is sent daily due to mailing list mode being enabled. To unsubscribe %{unsubscribe_link}."
from: "%{site_name} summary" from: "%{site_name} summary"
new_topics: "New topics" new_topics: "New topics"
@ -2546,7 +2546,7 @@ en:
back_to_top: "Back to top" back_to_top: "Back to top"
forgot_password: forgot_password:
title: "Forgot Password" title: "Forgot Password"
subject_template: "[%{site_name}] Password reset" subject_template: "[%{email_prefix}] Password reset"
text_body_template: | text_body_template: |
Somebody asked to reset your password on [%{site_name}](%{base_url}). Somebody asked to reset your password on [%{site_name}](%{base_url}).
@ -2557,7 +2557,7 @@ en:
set_password: set_password:
title: "Set Password" title: "Set Password"
subject_template: "[%{site_name}] Set Password" subject_template: "[%{email_prefix}] Set Password"
text_body_template: | text_body_template: |
Somebody asked to add a password to your account on [%{site_name}](%{base_url}). Alternatively, you can log in using any supported online service (Google, Facebook, etc) that is associated with this validated email address. Somebody asked to add a password to your account on [%{site_name}](%{base_url}). Alternatively, you can log in using any supported online service (Google, Facebook, etc) that is associated with this validated email address.
@ -2568,7 +2568,7 @@ en:
admin_login: admin_login:
title: "Admin Login" title: "Admin Login"
subject_template: "[%{site_name}] Login" subject_template: "[%{email_prefix}] Login"
text_body_template: | text_body_template: |
Somebody asked to login to your account on [%{site_name}](%{base_url}). Somebody asked to login to your account on [%{site_name}](%{base_url}).
@ -2579,7 +2579,7 @@ en:
account_created: account_created:
title: "Account Created" title: "Account Created"
subject_template: "[%{site_name}] Your New Account" subject_template: "[%{email_prefix}] Your New Account"
text_body_template: | text_body_template: |
A new account was created for you at %{site_name} A new account was created for you at %{site_name}
@ -2588,7 +2588,7 @@ en:
confirm_new_email: confirm_new_email:
title: "Confirm New Email" title: "Confirm New Email"
subject_template: "[%{site_name}] Confirm your new email address" subject_template: "[%{email_prefix}] Confirm your new email address"
text_body_template: | text_body_template: |
Confirm your new email address for %{site_name} by clicking on the following link: Confirm your new email address for %{site_name} by clicking on the following link:
@ -2596,7 +2596,7 @@ en:
confirm_old_email: confirm_old_email:
title: "Confirm Old Email" title: "Confirm Old Email"
subject_template: "[%{site_name}] Confirm your current email address" subject_template: "[%{email_prefix}] Confirm your current email address"
text_body_template: | text_body_template: |
Before we can change your email address, we need you to confirm that you control Before we can change your email address, we need you to confirm that you control
the current email account. After you complete this step, we will have you confirm the current email account. After you complete this step, we will have you confirm
@ -2608,7 +2608,7 @@ en:
notify_old_email: notify_old_email:
title: "Notify Old Email" title: "Notify Old Email"
subject_template: "[%{site_name}] Your email address has been changed" subject_template: "[%{email_prefix}] Your email address has been changed"
text_body_template: | text_body_template: |
This is an automated message to let you know that your email address for This is an automated message to let you know that your email address for
%{site_name} has been changed. If this was done in error, please contact %{site_name} has been changed. If this was done in error, please contact
@ -2641,7 +2641,7 @@ en:
signup: signup:
title: "Signup" title: "Signup"
subject_template: "[%{site_name}] Confirm your new account" subject_template: "[%{email_prefix}] Confirm your new account"
text_body_template: | text_body_template: |
Welcome to %{site_name}! Welcome to %{site_name}!

View File

@ -22,7 +22,8 @@ module Email
@opts = opts || {} @opts = opts || {}
@template_args = { @template_args = {
site_name: SiteSetting.email_prefix.presence || SiteSetting.title, site_name: SiteSetting.title,
email_prefix: SiteSetting.email_prefix.presence || SiteSetting.title,
base_url: Discourse.base_url, base_url: Discourse.base_url,
user_preferences_url: "#{Discourse.base_url}/my/preferences", user_preferences_url: "#{Discourse.base_url}/my/preferences",
hostname: Discourse.current_hostname, hostname: Discourse.current_hostname,
@ -59,7 +60,7 @@ module Email
def subject def subject
if @opts[:use_site_subject] if @opts[:use_site_subject]
subject = String.new(SiteSetting.email_subject) subject = String.new(SiteSetting.email_subject)
subject.gsub!("%{site_name}", @template_args[:site_name]) subject.gsub!("%{email_prefix}", @template_args[:email_prefix])
subject.gsub!("%{optional_re}", @opts[:add_re_to_subject] ? I18n.t('subject_re', @template_args) : '') subject.gsub!("%{optional_re}", @opts[:add_re_to_subject] ? I18n.t('subject_re', @template_args) : '')
subject.gsub!("%{optional_pm}", @opts[:private_reply] ? I18n.t('subject_pm', @template_args) : '') subject.gsub!("%{optional_pm}", @opts[:private_reply] ? I18n.t('subject_pm', @template_args) : '')
subject.gsub!("%{optional_cat}", @template_args[:show_category_in_subject] ? "[#{@template_args[:show_category_in_subject]}] " : '') subject.gsub!("%{optional_cat}", @template_args[:show_category_in_subject] ? "[#{@template_args[:show_category_in_subject]}] " : '')

View File

@ -199,13 +199,13 @@ describe Email::MessageBuilder do
context "template_args" do context "template_args" do
let(:template_args) { builder.template_args } let(:template_args) { builder.template_args }
it "has the site name as the site title when `SiteSetting.email_prefix` is not set" do it "has the email prefix as the site title when `SiteSetting.email_prefix` is not set" do
expect(template_args[:site_name]).to eq(SiteSetting.title) expect(template_args[:email_prefix]).to eq(SiteSetting.title)
end end
it "has the site name as SiteSetting.email_prefix when it is set" do it "has the email prefix as SiteSetting.email_prefix when it is set" do
SiteSetting.email_prefix = 'some email prefix' SiteSetting.email_prefix = 'some email prefix'
expect(template_args[:site_name]).to eq(SiteSetting.email_prefix) expect(template_args[:email_prefix]).to eq(SiteSetting.email_prefix)
end end
it "has the base url" do it "has the base url" do