diff options
author | francis <francis> | 2008-01-02 15:45:00 +0000 |
---|---|---|
committer | francis <francis> | 2008-01-02 15:45:00 +0000 |
commit | 007237437cfc11c1cf2b5807e8e9207f3cacd767 (patch) | |
tree | ba5ac31078d203bbfa8187a88b0b5af889882c43 /app/models/info_request.rb | |
parent | 69eb1d9e272153f0cf169cf5dd01000fd58fa4e8 (diff) |
Framework for logging different events about an FOI request.
Log outgoing messages as such events, so can know when one was resent.
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r-- | app/models/info_request.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index d1db6f1a4..17eea71e4 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -17,7 +17,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.17 2007-12-24 16:49:36 francis Exp $ +# $Id: info_request.rb,v 1.18 2008-01-02 15:45:00 francis Exp $ require 'digest/sha1' @@ -32,6 +32,7 @@ class InfoRequest < ActiveRecord::Base has_many :outgoing_messages has_many :incoming_messages + has_many :info_request_events # Email which public body should use to respond to request. This is in # the format PREFIXrequest-ID-HASH@DOMAIN. Here ID is the id of the @@ -123,6 +124,23 @@ class InfoRequest < ActiveRecord::Base end end + # Where the initial request is sent to + def recipient_email + if MySociety::Config.getbool("STAGING_SITE", 1) + return self.user.email + else + return self.public_body.request_email + end + end + + # History of some things that have happened + def log_event(type, params) + info_request_event = InfoRequestEvent.new + info_request_event.event_type = type + info_request_event.params = params + info_request_event.info_request = self + info_request_event.save! + end end |