diff options
-rw-r--r-- | app/controllers/info_request_batch_controller.rb | 9 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 18 | ||||
-rw-r--r-- | spec/controllers/request_controller_spec.rb | 10 |
3 files changed, 12 insertions, 25 deletions
diff --git a/app/controllers/info_request_batch_controller.rb b/app/controllers/info_request_batch_controller.rb index f76f7abc2..b66658757 100644 --- a/app/controllers/info_request_batch_controller.rb +++ b/app/controllers/info_request_batch_controller.rb @@ -4,8 +4,13 @@ class InfoRequestBatchController < ApplicationController @info_request_batch = InfoRequestBatch.find(params[:id]) @per_page = 25 @page = get_search_page_from_params - @info_requests = @info_request_batch.info_requests.all(:offset => (@page - 1) * @per_page, - :limit => @per_page) + if @info_request_batch.sent_at + @info_requests = @info_request_batch.info_requests.visible.all(:offset => (@page - 1) * @per_page, + :limit => @per_page) + else + @public_bodies = @info_request_batch.public_bodies.all(:offset => (@page - 1) * @per_page, + :limit => @per_page) + end end end diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 2bf1a2c0c..b3522ac54 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -247,24 +247,14 @@ class RequestController < ApplicationController @info_request_batch = InfoRequestBatch.create!(:title => params[:info_request][:title], :body => params[:outgoing_message][:body], :public_bodies => @public_bodies, - :user => authenticated_user ) - - batch_results = @info_request_batch.create_batch! - flash[:notice] = _("<p>Your {{law_used_full}} requests have been <strong>sent</strong>!</p> - <p><strong>We will email you</strong> when there is a response to any of them, or after {{late_number_of_days}} working days if the authorities still haven't + :user => authenticated_user) + flash[:notice] = _("<p>Your {{law_used_full}} requests will be <strong>sent</strong> shortly!</p> + <p><strong>We will email you</strong> when they have been sent. + We will also email you when there is a response to any of them, or after {{late_number_of_days}} working days if the authorities still haven't replied by then.</p> <p>If you write about these requests (for example in a forum or a blog) please link to this page.</p>", :law_used_full=>@info_request.law_used_full, :late_number_of_days => AlaveteliConfiguration::reply_late_after_days) - if ! batch_results[:unrequestable].empty? - error_messages = [] - error_messages << _('Unfortunately, we do not have a working address for {{public_body_names}}.', - :public_body_names => batch_results[:unrequestable].map{|body| body.name}.join(",")) - error_messages << _('You may be able to find one on their website, or by phoning them up and asking. If you manage - to find one, then please <a href="{{help_url}}">send it to us</a>.', - :help_url => help_contact_path) - flash[:error] = error_messages.map{ |message| "<p>#{message}</p>"}.join(" ").html_safe - end redirect_to info_request_batch_path(@info_request_batch) end diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 8a9cd93c2..c8d2dfb34 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -2588,18 +2588,10 @@ describe RequestController, "#new_batch" do it 'should display a success notice' do make_request - notice_text = "<p>Your Freedom of Information requests have been <strong>sent</strong>!</p>" + notice_text = "<p>Your Freedom of Information requests will be <strong>sent</strong> shortly!" flash[:notice].should match notice_text end - it 'should display notes about any bodies that could not be included' do - @other_public_body.request_email = '' - @other_public_body.save! - make_request - error_text = "Unfortunately, we do not have a working address for #{@other_public_body.name}." - flash[:error].should match error_text - end - end context "when the user is banned" do |