aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin_request_controller.rb7
-rw-r--r--app/models/contact_validator.rb4
-rw-r--r--app/models/incoming_message.rb4
-rw-r--r--app/models/info_request.rb12
-rw-r--r--app/models/info_request_event.rb4
-rw-r--r--app/models/outgoing_message.rb4
-rw-r--r--app/models/post_redirect.rb4
-rw-r--r--app/models/public_body.rb4
-rw-r--r--app/models/public_body_tag.rb4
-rw-r--r--app/models/request_mailer.rb14
-rw-r--r--app/models/track_thing.rb4
-rw-r--r--app/models/track_things_sent_email.rb4
-rw-r--r--app/models/user.rb4
-rw-r--r--app/models/user_info_request_sent_alert.rb4
-rw-r--r--app/views/admin_request/edit.rhtml4
-rw-r--r--app/views/request_mailer/stopped_responses.rhtml14
16 files changed, 68 insertions, 27 deletions
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb
index f94861b5e..02481a9aa 100644
--- a/app/controllers/admin_request_controller.rb
+++ b/app/controllers/admin_request_controller.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: admin_request_controller.rb,v 1.12 2008-05-12 00:56:21 francis Exp $
+# $Id: admin_request_controller.rb,v 1.13 2008-05-19 12:01:21 francis Exp $
class AdminRequestController < ApplicationController
layout "admin"
@@ -43,6 +43,7 @@ class AdminRequestController < ApplicationController
old_prominence = @info_request.prominence
old_described_state = @info_request.described_state
old_awaiting_description = @info_request.awaiting_description
+ old_stop_new_responses = @info_request.stop_new_responses
@info_request.title = params[:info_request][:title]
@info_request.prominence = params[:info_request][:prominence]
@@ -50,6 +51,7 @@ class AdminRequestController < ApplicationController
@info_request.set_described_state(params[:info_request][:described_state])
end
@info_request.awaiting_description = params[:info_request][:awaiting_description] == "true" ? true : false
+ @info_request.stop_new_responses = params[:info_request][:stop_new_responses] == "true" ? true : false
if @info_request.valid?
@info_request.save!
@@ -58,7 +60,8 @@ class AdminRequestController < ApplicationController
:old_title => old_title, :title => @info_request.title,
:old_prominence => old_prominence, :prominence => @info_request.prominence,
:old_described_state => old_described_state, :described_state => @info_request.described_state,
- :old_awaiting_description => old_awaiting_description, :awaiting_description => @info_request.awaiting_description
+ :old_awaiting_description => old_awaiting_description, :awaiting_description => @info_request.awaiting_description,
+ :old_stop_new_responses => old_stop_new_responses, :stop_new_responses => @info_request.stop_new_responses
})
flash[:notice] = 'Request successfully updated.'
redirect_to request_admin_url(@info_request)
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
diff --git a/app/views/admin_request/edit.rhtml b/app/views/admin_request/edit.rhtml
index e6d40337c..2d3745c1f 100644
--- a/app/views/admin_request/edit.rhtml
+++ b/app/views/admin_request/edit.rhtml
@@ -14,6 +14,10 @@
<%= select('info_request', "awaiting_description", [["Yes",true],["No",false]]) %>
</p>
+ <p><label for="info_request_stop_new_responses">Stop new responses</label> (use this on requests getting spam, but also work out how the email leaked and plug it)<br/>
+ <%= select('info_request', "stop_new_responses", [["Yes",true],["No",false]]) %>
+ </p>
+
<p><label for="info_request_described_state">Described state</label><br/>
<%= select( 'info_request', "described_state",
[
diff --git a/app/views/request_mailer/stopped_responses.rhtml b/app/views/request_mailer/stopped_responses.rhtml
new file mode 100644
index 000000000..43c6a2900
--- /dev/null
+++ b/app/views/request_mailer/stopped_responses.rhtml
@@ -0,0 +1,14 @@
+The email that you, on behalf of <%= @info_request.public_body.name%>, sent to
+<%= @info_request.user.name %> to reply to a Freedom of Information request has
+not been delivered.
+
+This is because '<%= @info_request.title %>' is an old request that has been
+marked to no longer receive responses.
+
+If this is incorrect, or you would like to send a late response to the request
+or an email on another subject to <%= @info_request.user.name %>, then please
+email <%=@contact_email%> for help.
+
+Your original message is attached.
+
+-- the WhatDoTheyKnow team