aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrancis <francis>2008-05-19 12:40:22 +0000
committerfrancis <francis>2008-05-19 12:40:22 +0000
commita4fe5668683f0a03d0c3029ff5f64309b03e51cf (patch)
treec30c1d50f461f161bf084bf0ef88f2cf32520e05
parent6e3c54b72c03f5b0d3bd46287b75808868df34b6 (diff)
Prevent sending of follow up messages for anti-spam marked requests. Since
there is no point being able to send follow ups if you won't get respones!
-rw-r--r--app/controllers/request_controller.rb36
-rw-r--r--app/views/request/_followup.rhtml46
2 files changed, 46 insertions, 36 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 063e2fd01..12aabcd6f 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/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: request_controller.rb,v 1.88 2008-05-18 21:53:15 francis Exp $
+# $Id: request_controller.rb,v 1.89 2008-05-19 12:40:22 francis Exp $
class RequestController < ApplicationController
@@ -275,22 +275,26 @@ class RequestController < ApplicationController
end
if !params[:submitted_followup].nil?
- # See if values were valid or not
- @outgoing_message.info_request = @info_request
- if !@outgoing_message.valid?
- render :action => 'show_response'
- elsif authenticated_as_user?(@info_request.user,
- :web => "To send your follow up message about your FOI request",
- :email => "Then your follow up message to " + @info_request.public_body.name + " will be sent.",
- :email_subject => "Confirm your FOI follow up message to " + @info_request.public_body.name
- )
- # Send a follow up message
- @outgoing_message.send_message
- @outgoing_message.save!
- flash[:notice] = "Your follow up message has been created and sent on its way."
- redirect_to request_url(@info_request)
+ if @info_request.stop_new_responses
+ flash[:notice] = 'Your follow up has not been sent because this request has been stopped to prevent spam. Please <a href="/help/contact">contact us</a> if you really want to send a follow up message.'
else
- # do nothing - as "authenticated?" has done the redirect to signin page for us
+ # See if values were valid or not
+ @outgoing_message.info_request = @info_request
+ if !@outgoing_message.valid?
+ render :action => 'show_response'
+ elsif authenticated_as_user?(@info_request.user,
+ :web => "To send your follow up message about your FOI request",
+ :email => "Then your follow up message to " + @info_request.public_body.name + " will be sent.",
+ :email_subject => "Confirm your FOI follow up message to " + @info_request.public_body.name
+ )
+ # Send a follow up message
+ @outgoing_message.send_message
+ @outgoing_message.save!
+ flash[:notice] = "Your follow up message has been created and sent on its way."
+ redirect_to request_url(@info_request)
+ else
+ # do nothing - as "authenticated?" has done the redirect to signin page for us
+ end
end
else
# render default show_response template
diff --git a/app/views/request/_followup.rhtml b/app/views/request/_followup.rhtml
index 8e3b45f67..0a9df60c2 100644
--- a/app/views/request/_followup.rhtml
+++ b/app/views/request/_followup.rhtml
@@ -12,30 +12,36 @@
</h2>
<% end %>
- <p>Use this to tell the public authority something, such as to clarify
- your request, or if they are late responding.</p>
-
- <% form_for(:outgoing_message, @outgoing_message) do |o| %>
- <p>
- <%= o.text_area :body, :rows => 10, :cols => 55 %>
- </p>
-
- <p>
- <strong>Privacy warning:</strong> Your follow up message, and any response
- to it, will also be displayed publically on this website.
- </p>
+ <% if @info_request.stop_new_responses %>
+ <p>Follow ups and new responses to this request have been stopped to prevent spam. Please
+ <a href="/help/contact">contact us</a> if you are <%= user_link(@info_request.user) %>
+ and need to send a follow up.</p>
+ <% else %>
+ <p>Use this to tell the public authority something, such as to clarify
+ your request, or if they are late responding.</p>
+
+ <% form_for(:outgoing_message, @outgoing_message) do |o| %>
+ <p>
+ <%= o.text_area :body, :rows => 10, :cols => 55 %>
+ </p>
+
+ <p>
+ <strong>Privacy warning:</strong> Your follow up message, and any response
+ to it, will also be displayed publically on this website.
+ </p>
+
+ <p>
+ <%= hidden_field_tag 'submitted_followup', 1 %>
+ <%= submit_tag "Send public follow up message" %>
+ </p>
+ <% end %>
<p>
- <%= hidden_field_tag 'submitted_followup', 1 %>
- <%= submit_tag "Send public follow up message" %>
+ <% if not @is_owning_user %>
+ (You will be asked to sign in as <%= user_link(@info_request.user) %>)
+ <% end %>
</p>
<% end %>
- <p>
- <% if not @is_owning_user %>
- (You will be asked to sign in as <%= user_link(@info_request.user) %>)
- <% end %>
- </p>
-
</div>