aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/info_request.rb
diff options
context:
space:
mode:
authorfrancis <francis>2008-01-29 03:05:46 +0000
committerfrancis <francis>2008-01-29 03:05:46 +0000
commit5acedd09b79642d58c6de5db872f82198b2f2c73 (patch)
tree1717bd038849262e6abbca2c582cd2d09289c640 /app/models/info_request.rb
parentde7f36c6e3c5f1739a60839fe6bf3e7d510e1225 (diff)
Redirect to appropriate messages for most of the classification options.
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r--app/models/info_request.rb13
1 files changed, 12 insertions, 1 deletions
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