aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/request_controller.rb23
-rw-r--r--app/views/user/rate_limited.rhtml14
2 files changed, 32 insertions, 5 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index fc1ffdd75..ccd9636d1 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -207,18 +207,28 @@ class RequestController < ApplicationController
end
# Banned from making new requests?
+ user_exceeded_limit = false
if !authenticated_user.nil? && !authenticated_user.can_file_requests?
- if authenticated_user.exceeded_limit?
- render :template => 'user/rate_limited'
- else
+ # If the reason the user cannot make new requests is that they are
+ # rate-limited, it’s possible they composed a request before they
+ # logged in and we want to include the text of the request so they
+ # can squirrel it away for tomorrow, so we detect this later after
+ # we have constructed the InfoRequest.
+ user_exceeded_limit = authenticated_user.exceeded_limit?
+ if !user_exceeded_limit
@details = authenticated_user.can_fail_html
render :template => 'user/banned'
+ return
end
- return
end
# First time we get to the page, just display it
if params[:submitted_new_request].nil? || params[:reedit]
+ if user_exceeded_limit
+ render :template => 'user/rate_limited'
+ return
+ end
+
params[:info_request] = { } if !params[:info_request]
# Read parameters in - first the public body (by URL name or id)
@@ -318,6 +328,11 @@ class RequestController < ApplicationController
return
end
+ if user_exceeded_limit
+ render :template => 'user/rate_limited'
+ return
+ end
+
if !authenticated?(
:web => _("To send your FOI request"),
:email => _("Then your FOI request to {{public_body_name}} will be sent.",:public_body_name=>@info_request.public_body.name),
diff --git a/app/views/user/rate_limited.rhtml b/app/views/user/rate_limited.rhtml
index d513cec9e..c1e8f360e 100644
--- a/app/views/user/rate_limited.rhtml
+++ b/app/views/user/rate_limited.rhtml
@@ -2,4 +2,16 @@
<h1><%=@title%></h1>
-<p><%= _('You have made too many requests today. Please try again tomorrow.')%></p>
+<p><%= _("There is a limit on the number of requests that you can make in any one day. You can make more requests tomorrow.")%></p>
+
+<!-- Insert explanation of why we have a limit -->
+
+<p><%= _("If you need to make more requests than this, <a href='%s'>get in touch</a> and we’ll consider it.") % [help_contact_path] %></p>
+
+<% if @info_request %>
+ <p><%= _("Here is the message you wrote, in case you would like to copy the text and save it for later.") %></p>
+
+ <div class="correspondence">
+ <div class="correspondence_text"><%= @info_request.outgoing_messages[0].get_body_for_html_display %></div>
+ </div>
+<% end %>