diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/contact_validator.rb | 4 | ||||
-rw-r--r-- | app/models/incoming_message.rb | 4 | ||||
-rw-r--r-- | app/models/info_request.rb | 12 | ||||
-rw-r--r-- | app/models/info_request_event.rb | 4 | ||||
-rw-r--r-- | app/models/outgoing_message.rb | 4 | ||||
-rw-r--r-- | app/models/post_redirect.rb | 4 | ||||
-rw-r--r-- | app/models/public_body.rb | 4 | ||||
-rw-r--r-- | app/models/public_body_tag.rb | 4 | ||||
-rw-r--r-- | app/models/request_mailer.rb | 14 | ||||
-rw-r--r-- | app/models/track_thing.rb | 4 | ||||
-rw-r--r-- | app/models/track_things_sent_email.rb | 4 | ||||
-rw-r--r-- | app/models/user.rb | 4 | ||||
-rw-r--r-- | app/models/user_info_request_sent_alert.rb | 4 |
13 files changed, 45 insertions, 25 deletions
diff --git a/app/models/contact_validator.rb b/app/models/contact_validator.rb index 155219999..2738c9571 100644 --- a/app/models/contact_validator.rb +++ b/app/models/contact_validator.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 54 +# Schema version: 55 # # Table name: contact_validators # @@ -15,7 +15,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: contact_validator.rb,v 1.13 2008-05-12 01:38:18 francis Exp $ +# $Id: contact_validator.rb,v 1.14 2008-05-19 12:01:22 francis Exp $ class ContactValidator < ActiveRecord::BaseWithoutTable column :name, :string diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index 43231761a..878997a11 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 54 +# Schema version: 55 # # Table name: incoming_messages # @@ -17,7 +17,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: incoming_message.rb,v 1.100 2008-05-12 23:07:31 francis Exp $ +# $Id: incoming_message.rb,v 1.101 2008-05-19 12:01:22 francis Exp $ # TODO # Move some of the (e.g. quoting) functions here into rblib, as they feel diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 64ed65a63..1f30c3cbb 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 54 +# Schema version: 55 # # Table name: info_requests # @@ -13,6 +13,7 @@ # awaiting_description :boolean default(false), not null # prominence :string(255) default("normal"), not null # url_title :text not null +# stop_new_responses :boolean default(false), not null # # models/info_request.rb: @@ -21,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.111 2008-05-16 19:19:42 francis Exp $ +# $Id: info_request.rb,v 1.112 2008-05-19 12:01:22 francis Exp $ require 'digest/sha1' require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian') @@ -164,6 +165,13 @@ public # A new incoming email to this request def receive(email, raw_email) + # See if new responses are prevented for spam reasons + if self.stop_new_responses + RequestMailer.deliver_stopped_responses(self, email) + return + end + + # Otherwise log the message incoming_message = IncomingMessage.new ActiveRecord::Base.transaction do diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb index a692fec0d..b040f6320 100644 --- a/app/models/info_request_event.rb +++ b/app/models/info_request_event.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 54 +# Schema version: 55 # # Table name: info_request_events # @@ -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_event.rb,v 1.43 2008-05-12 01:38:38 francis Exp $ +# $Id: info_request_event.rb,v 1.44 2008-05-19 12:01:22 francis Exp $ class InfoRequestEvent < ActiveRecord::Base belongs_to :info_request diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb index 52d60dd8a..cf906a1a1 100644 --- a/app/models/outgoing_message.rb +++ b/app/models/outgoing_message.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 54 +# Schema version: 55 # # Table name: outgoing_messages # @@ -21,7 +21,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: outgoing_message.rb,v 1.48 2008-05-16 12:30:13 francis Exp $ +# $Id: outgoing_message.rb,v 1.49 2008-05-19 12:01:22 francis Exp $ class OutgoingMessage < ActiveRecord::Base belongs_to :info_request diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb index 9242ebf3f..5f732e36a 100644 --- a/app/models/post_redirect.rb +++ b/app/models/post_redirect.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 54 +# Schema version: 55 # # Table name: post_redirects # @@ -26,7 +26,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: post_redirect.rb,v 1.31 2008-05-12 01:38:18 francis Exp $ +# $Id: post_redirect.rb,v 1.32 2008-05-19 12:01:22 francis Exp $ require 'openssl' # for random bytes function diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 376f3329e..e5f5cd667 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 54 +# Schema version: 55 # # Table name: public_bodies # @@ -21,7 +21,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: public_body.rb,v 1.69 2008-05-12 01:38:38 francis Exp $ +# $Id: public_body.rb,v 1.70 2008-05-19 12:01:22 francis Exp $ require 'csv' require 'set' diff --git a/app/models/public_body_tag.rb b/app/models/public_body_tag.rb index 0f4f164ee..2bad6778c 100644 --- a/app/models/public_body_tag.rb +++ b/app/models/public_body_tag.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 54 +# Schema version: 55 # # Table name: public_body_tags # @@ -15,7 +15,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: public_body_tag.rb,v 1.11 2008-05-12 01:38:18 francis Exp $ +# $Id: public_body_tag.rb,v 1.12 2008-05-19 12:01:22 francis Exp $ class PublicBodyTag < ActiveRecord::Base validates_presence_of :public_body diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb index 09599b62e..cb43b59f8 100644 --- a/app/models/request_mailer.rb +++ b/app/models/request_mailer.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: request_mailer.rb,v 1.31 2008-05-18 21:57:42 francis Exp $ +# $Id: request_mailer.rb,v 1.32 2008-05-19 12:01:22 francis Exp $ class RequestMailer < ApplicationMailer @@ -40,6 +40,18 @@ class RequestMailer < ApplicationMailer email.setup_forward(self) end + # Incoming message arrived for a request, but new responses have been stopped. + def stopped_responses(info_request, email) + @from = contact_from_name_and_email + @recipients = email.from_addrs.to_s + @subject = "Your response to an FOI request was not delivered" + email.setup_forward(self) + @body = { + :info_request => info_request, + :contact_email => MySociety::Config.get("CONTACT_EMAIL", 'contact@localhost') + } + end + # An FOI response is outside the scope of the system, and needs admin attention def requires_admin(info_request) @from = contact_from_name_and_email diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb index e5fa8f047..7fb72bff6 100644 --- a/app/models/track_thing.rb +++ b/app/models/track_thing.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 54 +# Schema version: 55 # # Table name: track_things # @@ -21,7 +21,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: track_thing.rb,v 1.21 2008-05-16 00:05:09 francis Exp $ +# $Id: track_thing.rb,v 1.22 2008-05-19 12:01:22 francis Exp $ class TrackThing < ActiveRecord::Base belongs_to :tracking_user, :class_name => 'User' diff --git a/app/models/track_things_sent_email.rb b/app/models/track_things_sent_email.rb index 4e6ce3001..eede4b5fc 100644 --- a/app/models/track_things_sent_email.rb +++ b/app/models/track_things_sent_email.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 54 +# Schema version: 55 # # Table name: track_things_sent_emails # @@ -18,7 +18,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: track_things_sent_email.rb,v 1.5 2008-05-16 01:14:12 francis Exp $ +# $Id: track_things_sent_email.rb,v 1.6 2008-05-19 12:01:22 francis Exp $ class TrackThingsSentEmail < ActiveRecord::Base belongs_to :info_request_event diff --git a/app/models/user.rb b/app/models/user.rb index b7727329d..ec34c8a6f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 54 +# Schema version: 55 # # Table name: users # @@ -21,7 +21,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: user.rb,v 1.54 2008-05-12 01:38:38 francis Exp $ +# $Id: user.rb,v 1.55 2008-05-19 12:01:22 francis Exp $ require 'digest/sha1' diff --git a/app/models/user_info_request_sent_alert.rb b/app/models/user_info_request_sent_alert.rb index 48e116d9a..7af7a599a 100644 --- a/app/models/user_info_request_sent_alert.rb +++ b/app/models/user_info_request_sent_alert.rb @@ -1,5 +1,5 @@ # == Schema Information -# Schema version: 54 +# Schema version: 55 # # Table name: user_info_request_sent_alerts # @@ -17,7 +17,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: user_info_request_sent_alert.rb,v 1.13 2008-05-12 01:38:18 francis Exp $ +# $Id: user_info_request_sent_alert.rb,v 1.14 2008-05-19 12:01:22 francis Exp $ class UserInfoRequestSentAlert < ActiveRecord::Base belongs_to :user |