diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/link_to_helper.rb | 6 | ||||
-rw-r--r-- | app/models/info_request.rb | 12 |
2 files changed, 13 insertions, 5 deletions
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 79bdcd904..5c7242d18 100644 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -5,7 +5,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: link_to_helper.rb,v 1.12 2008-01-29 03:05:47 francis Exp $ +# $Id: link_to_helper.rb,v 1.13 2008-01-30 09:53:47 francis Exp $ module LinkToHelper @@ -74,10 +74,10 @@ module LinkToHelper # About page URLs def about_url - return help_general_url :action => 'about' + return help_general_url(:action => 'about') end def unhappy_url - return help_general_url :action => 'unhappy' + return help_general_url(:action => 'unhappy') end diff --git a/app/models/info_request.rb b/app/models/info_request.rb index a417ecc3c..5ff0b3a1c 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -20,7 +20,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request.rb,v 1.31 2008-01-29 03:05:47 francis Exp $ +# $Id: info_request.rb,v 1.32 2008-01-30 09:53:47 francis Exp $ require 'digest/sha1' @@ -48,6 +48,10 @@ class InfoRequest < ActiveRecord::Base 'partially_successful' ] + def after_initialize + self.described_state = 'waiting_response' + end + public # Email which public body should use to respond to request. This is in # the format PREFIXrequest-ID-HASH@DOMAIN. Here ID is the id of the @@ -89,8 +93,9 @@ public # A new incoming email to this request def receive(email, raw_email, is_bounce) + incoming_message = IncomingMessage.new + ActiveRecord::Base.transaction do - incoming_message = IncomingMessage.new incoming_message.raw_data = raw_email incoming_message.is_bounce = is_bounce incoming_message.info_request = self @@ -149,6 +154,9 @@ public # clarifications asked for by the public body, and so reset things. # Possibly just show 20 working days since the *last* message? Hmmm. earliest_sent = self.outgoing_messages.map { |om| om.last_sent_at }.min + if earliest_sent.nil? + raise "internal error, minimum last_sent_at for outgoing_messages is nil for request " + self.id.to_s + end days_passed = 0 response_required_by = earliest_sent |