FEATURE: add site preference for standard subjects, including support for Re

This commit is contained in:
Arpit Jalan
2014-09-29 10:46:55 +05:30
parent 5d91a4ef0c
commit 330b7ba54a
5 changed files with 79 additions and 3 deletions

View File

@@ -40,8 +40,16 @@ module Email
end
def subject
subject = @opts[:subject]
subject = I18n.t("#{@opts[:template]}.subject_template", template_args) if @opts[:template]
if @opts[:use_site_subject]
subject = String.new(SiteSetting.email_subject)
subject.gsub!("%{site_name}", @template_args[:site_name])
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!("%{topic_title}", @template_args[:topic_title]) if @template_args[:topic_title] # must be last for safety
else
subject = @opts[:subject]
subject = I18n.t("#{@opts[:template]}.subject_template", template_args) if @opts[:template]
end
subject
end