FIX: customized email subjects was ignored for some notifications

Email templates for notifications about new posts and topics weren't
using customized values.
This commit is contained in:
Neil Lalonde
2020-01-29 14:48:55 -05:00
parent 2ee6a615b7
commit 34f564acd6
2 changed files with 18 additions and 1 deletions

View File

@ -51,7 +51,10 @@ module Email
end
def subject
if @opts[:use_site_subject]
if @opts[:template] &&
TranslationOverride.exists?(locale: I18n.locale, translation_key: "#{@opts[:template]}.subject_template")
subject = I18n.t("#{@opts[:template]}.subject_template", @template_args)
elsif @opts[:use_site_subject]
subject = String.new(SiteSetting.email_subject)
subject.gsub!("%{site_name}", @template_args[:email_prefix])
subject.gsub!("%{optional_re}", @opts[:add_re_to_subject] ? I18n.t('subject_re') : '')