diff options
-rw-r--r-- | app/controllers/request_controller.rb | 7 | ||||
-rw-r--r-- | app/views/request/followup_bad.rhtml | 3 | ||||
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 16 |
3 files changed, 26 insertions, 0 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 60b33fe28..540ed5f3d 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -585,6 +585,13 @@ class RequestController < ApplicationController return end + # Test for external request + if @info_request.is_external? + @reason = 'external' + render :action => 'followup_bad' + return + end + # Force login early - this is really the "send followup" form. We want # to make sure they're the right user first, before they start writing a # message and wasting their time if they are not the requester. diff --git a/app/views/request/followup_bad.rhtml b/app/views/request/followup_bad.rhtml index 306eddd10..7efa3f826 100644 --- a/app/views/request/followup_bad.rhtml +++ b/app/views/request/followup_bad.rhtml @@ -25,6 +25,9 @@ one on their website, or by phoning them up and asking. If you manage to find one, then please <a href="%s">send it to us</a>.') % [help_contact_path] %> </p> +<% elsif @reason == 'external' %> + <p><%= _("Followups cannot be sent for this request, as it was made externally, and published here by {{public_body_name}} on the requester's behalf.", :public_body_name => h(@info_request.public_body.name)) %> + </p> <% else %> <% raise _("unknown reason ") + @reason %> <% end %> diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 6e5498a9f..6cbe1c836 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -1014,6 +1014,22 @@ describe RequestController, "when viewing an individual response for reply/follo get :show_response, :id => info_requests(:fancy_dog_request).id, :incoming_message_id => incoming_messages(:useless_incoming_message) response.should render_template('request/hidden') end + + describe 'when viewing a response for an external request' do + + it 'should show a message saying that external requests cannot be followed up' do + get :show_response, :id => info_requests(:external_request).id + response.should render_template('request/followup_bad') + assigns[:reason].should == 'external' + end + + it 'should be successful' do + get :show_response, :id => info_requests(:external_request).id + response.should be_success + end + + end + end describe RequestController, "when classifying an information request" do |