diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-02-15 16:23:48 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-02-15 16:23:48 +0000 |
commit | 9a3dafc38b8bc6aed9d1134d188b3a7ec567e39f (patch) | |
tree | fff1fa4f6878f1ba7be638f43c9e85e58635319e /app/models/application_mailer.rb | |
parent | 7d037e56eea7c67acac5a8afca2ba9a33cb6d2c2 (diff) | |
parent | feefa1b5d9c8765cef63dd6601805b912e7d475c (diff) |
Merge branch 'hotfix/0.7.0.1' into develop
Diffstat (limited to 'app/models/application_mailer.rb')
-rw-r--r-- | app/models/application_mailer.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/application_mailer.rb b/app/models/application_mailer.rb index cdb279c3c..1a97a4bf9 100644 --- a/app/models/application_mailer.rb +++ b/app/models/application_mailer.rb @@ -77,6 +77,17 @@ class ApplicationMailer < ActionMailer::Base # and via template_path, which is created from it) in the create! method when # looking for templates. Our modified version looks for templates in the view_paths # in order. + + # It also has a line converting the mail subject to a string. This is because we + # use translated strings in the subject lines, sometimes in conjunction with + # user input, like request titles. The _() function used for translation + # returns an instance of SafeBuffer, which doesn't handle gsub calls in the block form + # with $ variables - https://github.com/rails/rails/issues/1555. + # Unfortunately ActionMailer uses that form in quoted_printable(), which will be + # called if any part of the subject requires quoting. So we convert the subject + # back to a string via to_str() before passing in to create_mail. There is a test + # for this in spec/models/request_mailer_spec.rb + # Changed lines marked with *** # Initialize the mailer via the given +method_name+. The body will be @@ -139,6 +150,9 @@ class ApplicationMailer < ActionMailer::Base # already set. @mime_version ||= "1.0" if !@parts.empty? + # *** Convert into a string + @subject = @subject.to_str if @subject + # build the mail object itself @mail = create_mail end |