From c13e2c17a9166b926a7ad1a3a2b0bef5839ed676 Mon Sep 17 00:00:00 2001 From: francis Date: Thu, 14 Feb 2008 09:55:21 +0000 Subject: For requests awaiting clarification, link to the follow up form. --- app/models/info_request.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'app/models/info_request.rb') 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 -- cgit v1.2.3