Skip to content

Commit

Permalink
Allow calling code to specify context.
Browse files Browse the repository at this point in the history
A non-html means that strings will be marked as safe.

Requires 0d43506cb81c2e549ff58e61ccace2c686c16876 in the main alaveteli
repo.
  • Loading branch information
crowbot committed Feb 9, 2015
1 parent 97f45b6 commit 54466b0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/model_patches.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ def survey
UserInfoRequestSentAlert._validate_callbacks[0].options[:in] << 'survey_1'

InfoRequest.class_eval do
def email_subject_request
if (!self.is_batch_request_template?) && (self.public_body.url_name == 'general_register_office')
def email_subject_request(opts = {})
html = opts.fetch(:html, true)
title = html ? self.title : self.title.html_safe
if (!is_batch_request_template?) && (public_body.url_name == 'general_register_office')
# without GQ in the subject, you just get an auto response
_('{{law_used_full}} request GQ - {{title}}',:law_used_full=>self.law_used_full,:title=>self.title.html_safe)
_('{{law_used_full}} request GQ - {{title}}', :law_used_full => law_used_full,
:title => title)
else
_('{{law_used_full}} request - {{title}}',:law_used_full=>self.law_used_full,:title=>self.title.html_safe)
_('{{law_used_full}} request - {{title}}', :law_used_full => law_used_full,
:title => title)
end
end
end
Expand Down

0 comments on commit 54466b0

Please sign in to comment.