diff options
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r-- | app/models/info_request.rb | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index d3285116c..e439ee656 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -21,7 +21,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.106 2008-05-09 01:02:32 francis Exp $ +# $Id: info_request.rb,v 1.107 2008-05-12 00:56:22 francis Exp $ require 'digest/sha1' require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian') @@ -178,12 +178,11 @@ public RequestMailer.deliver_new_response(self, incoming_message) end - # Change status - event id is of the most recent event at the change - # XXX should probably check event id is last event here - def set_described_state(new_state, event_id) + # Change status, including for last event for later historical purposes + def set_described_state(new_state) ActiveRecord::Base.transaction do self.awaiting_description = false - last_event = InfoRequestEvent.find(event_id) + last_event = self.get_last_event last_event.described_state = new_state self.described_state = new_state last_event.save! @@ -358,6 +357,16 @@ public end # The last response is the default one people might want to reply to + def get_last_response_event + info_request_event_id = get_last_response_event_id + if info_request_event_id.nil? + return nil + else + return InfoRequestEvent.find(info_request_event_id) + end + end + + # The last response is the default one people might want to reply to def get_last_response event_id = self.get_last_response_event_id if event_id.nil? |