aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/request_controller.rb6
-rw-r--r--spec/controllers/request_controller_spec.rb15
2 files changed, 20 insertions, 1 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 718a8aada..e249bbe5c 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -194,7 +194,11 @@ class RequestController < ApplicationController
# TODO: Decide if we make batch requesters describe their undescribed requests
# before being able to make a new batch request
- # TODO: Add logic for checking if the user is banned
+
+ if !authenticated_user.can_file_requests?
+ @details = authenticated_user.can_fail_html
+ render :template => 'user/banned' and return
+ end
@batch = true
if params[:submitted_new_request].nil? || params[:reedit]
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 2f1c2d07b..38566fde0 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -2563,6 +2563,21 @@ describe RequestController, "#new_batch", :focus => true do
response.should render_template('new')
end
+ context "when the user is banned" do
+
+ before do
+ @user.ban_text = "bad behaviour"
+ @user.save!
+ end
+
+ it 'should show the "banned" template' do
+ post :new_batch, @default_post_params, { :user_id => @user.id }
+ response.should render_template('user/banned')
+ assigns[:details].should == 'bad behaviour'
+ end
+
+ end
+
end
context "when the current user can't make batch requests" do