aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/info_request.rb
diff options
context:
space:
mode:
authorfrancis <francis>2008-07-08 09:41:04 +0000
committerfrancis <francis>2008-07-08 09:41:04 +0000
commit1aeaee94a47c6a912082f60085e130dac330bd19 (patch)
treeefe41d77c1d3390a8641ac354047fc9a426e2aa1 /app/models/info_request.rb
parent7028e3cce83ce9e86d9620076257244a39585d7a (diff)
Store incoming messages which aren't to a valid request in a holding pen, and
let people move them from admin interface.
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r--app/models/info_request.rb30
1 files changed, 29 insertions, 1 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 33fc87357..e174dff7b 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -22,7 +22,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.117 2008-06-11 15:00:35 francis Exp $
+# $Id: info_request.rb,v 1.118 2008-07-08 09:41:04 francis Exp $
require 'digest/sha1'
require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian')
@@ -242,6 +242,34 @@ public
RequestMailer.deliver_new_response(self, incoming_message)
end
+ # The "holding pen" is a special request which stores incoming emails whose
+ # destination request is unknown.
+ def InfoRequest.holding_pen_request
+ ir = InfoRequest.find_by_url_title("holding_pen")
+ if ir.nil?
+ ir = InfoRequest.new(
+ :user => User.internal_admin_user,
+ :public_body => PublicBody.internal_admin_body,
+ :title => 'Holding pen',
+ :described_state => 'waiting_response',
+ :awaiting_description => false,
+ :prominence => 'backpage'
+ )
+ om = OutgoingMessage.new({
+ :status => 'ready',
+ :message_type => 'initial_request',
+ :body => 'This is the holding pen request. It shows responses that were sent to invalid addresses, and need moving to the correct request by an adminstrator.',
+ :last_sent_at => Time.now()
+ })
+ ir.outgoing_messages << om
+ om.info_request = ir
+ ir.save!
+ ir.log_event('sent', { :outgoing_message_id => om.id, :email => ir.public_body.request_email })
+ end
+
+ return ir
+ end
+
# Change status, including for last event for later historical purposes
def set_described_state(new_state)
ActiveRecord::Base.transaction do