From 5acedd09b79642d58c6de5db872f82198b2f2c73 Mon Sep 17 00:00:00 2001 From: francis Date: Tue, 29 Jan 2008 03:05:46 +0000 Subject: Redirect to appropriate messages for most of the classification options. --- app/models/info_request.rb | 13 ++++++++++++- 1 file changed, 12 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 0207bca94..a417ecc3c 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.30 2008-01-29 01:26:21 francis Exp $ +# $Id: info_request.rb,v 1.31 2008-01-29 03:05:47 francis Exp $ require 'digest/sha1' @@ -216,6 +216,17 @@ public return excerpt end + # Returns all the messages which the user hasn't described yet + def incoming_messages_needing_description + if self.described_last_incoming_message_id.nil? + correspondences = self.incoming_messages.find(:all) + else + correspondences = self.incoming_messages.find(:all, :conditions => "id > " + self.described_last_incoming_message_id.to_s) + end + correspondences.sort! { |a,b| a.sent_at <=> b.sent_at } + return correspondences + end + protected # Called by incoming_email and envelope_email -- cgit v1.2.3