diff options
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r-- | app/models/info_request.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 8e62b04d7..346600bc6 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -19,7 +19,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.36 2008-02-13 09:32:55 francis Exp $ +# $Id: info_request.rb,v 1.37 2008-02-14 09:55:21 francis Exp $ require 'digest/sha1' @@ -238,6 +238,18 @@ public info_request_event.save! end + # The last response is the default one people might want to reply to + def get_last_response + events = self.info_request_events.find(:all, :order => "created_at") + events.reverse.each do |e| + if e.event_type == 'response' + id = e.params[:incoming_message_id].to_i + return IncomingMessage.find(id) + end + end + return nil + end + # Text from the the initial request, for use in summary display def initial_request_text if outgoing_messages.empty? # mainly for use with incomplete fixtures |