diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-05-07 13:50:13 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-05-07 13:50:13 +0100 |
commit | d621ad639d6fd4eaac1b3f0056b8f474f1943c97 (patch) | |
tree | b20ccf84a303a8239c6e31f855803982adb08dd1 | |
parent | a23b6c0c38d283d36ab002e8a8436002282a936a (diff) |
Allow the default text of an internal review request to be translated.
-rw-r--r-- | app/models/outgoing_message.rb | 22 | ||||
-rw-r--r-- | spec/models/outgoing_message_spec.rb | 19 |
2 files changed, 33 insertions, 8 deletions
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb index dbe2cf1ca..aedfb9cad 100644 --- a/app/models/outgoing_message.rb +++ b/app/models/outgoing_message.rb @@ -23,6 +23,14 @@ # Email: hello@mysociety.org; WWW: http://www.mysociety.org/ class OutgoingMessage < ActiveRecord::Base + include Rails.application.routes.url_helpers + include LinkToHelper + self.default_url_options[:host] = AlaveteliConfiguration::domain + # https links in emails if forcing SSL + if AlaveteliConfiguration::force_ssl + self.default_url_options[:protocol] = "https" + end + strip_attributes! belongs_to :info_request @@ -80,15 +88,15 @@ class OutgoingMessage < ActiveRecord::Base end if self.what_doing == 'internal_review' - "Please pass this on to the person who conducts Freedom of Information reviews." + + _("Please pass this on to the person who conducts Freedom of Information reviews.") + "\n\n" + - "I am writing to request an internal review of " + - self.info_request.public_body.name + - "'s handling of my FOI request " + - "'" + self.info_request.title + "'." + + _("I am writing to request an internal review of {{public_body_name}}'s handling of my FOI request '{{info_request_title}}'.", + :public_body_name => self.info_request.public_body.name, + :info_request_title => self.info_request.title) + "\n\n\n\n [ " + self.get_internal_review_insert_here_note + " ] \n\n\n\n" + - "A full history of my FOI request and all correspondence is available on the Internet at this address:\n" + - "http://" + AlaveteliConfiguration::domain + "/request/" + self.info_request.url_title + _("A full history of my FOI request and all correspondence is available on the Internet at this address: {{url}}", + :url => request_url(self.info_request)) + + "\n" else "" end diff --git a/spec/models/outgoing_message_spec.rb b/spec/models/outgoing_message_spec.rb index 51bb6fdf5..60164fb31 100644 --- a/spec/models/outgoing_message_spec.rb +++ b/spec/models/outgoing_message_spec.rb @@ -16,7 +16,7 @@ describe OutgoingMessage, " when making an outgoing message" do it "should not index the email addresses" do # also used for track emails @outgoing_message.get_text_for_indexing.should_not include("foo@bar.com") - end + end it "should not display email addresses on page" do @outgoing_message.get_body_for_html_display.should_not include("foo@bar.com") @@ -33,6 +33,23 @@ describe OutgoingMessage, " when making an outgoing message" do it "should work out a salutation" do @om.get_salutation.should == "Dear Geraldine Quango," end + + it 'should produce the expected text for an internal review request' do + public_body = mock_model(PublicBody, :name => 'A test public body') + info_request = mock_model(InfoRequest, :public_body => public_body, + :url_title => 'a_test_title', + :title => 'A test title', + :apply_censor_rules_to_text! => nil) + outgoing_message = OutgoingMessage.new({ + :status => 'ready', + :message_type => 'followup', + :what_doing => 'internal_review', + :info_request => info_request + }) + expected_text = "I am writing to request an internal review of A test public body's handling of my FOI request 'A test title'." + outgoing_message.body.should include(expected_text) + end + end |