From: Ward Vandewege Date: Wed, 5 Jan 2022 19:34:45 +0000 (-0500) Subject: 18577: workbench1: remove references to `redirect_to :back`, this X-Git-Tag: 2.4.0~119^2~1 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/b6cbf9d7dc789ce57cc324ad02569187c8db8c54 18577: workbench1: remove references to `redirect_to :back`, this stopped working in Rails 5.1. Arvados-DCO-1.1-Signed-off-by: Ward Vandewege --- diff --git a/apps/workbench/app/controllers/actions_controller.rb b/apps/workbench/app/controllers/actions_controller.rb index b0b7a0b64d..3667d8acaa 100644 --- a/apps/workbench/app/controllers/actions_controller.rb +++ b/apps/workbench/app/controllers/actions_controller.rb @@ -49,7 +49,7 @@ class ActionsController < ApplicationController return self.send(param) end end - redirect_to :back + redirect_back(fallback_location: root_path) end expose_action :copy_selections_into_project do diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb index 04055f8485..5312e733f4 100644 --- a/apps/workbench/app/controllers/application_controller.rb +++ b/apps/workbench/app/controllers/application_controller.rb @@ -417,7 +417,11 @@ class ApplicationController < ActionController::Base respond_to do |f| f.json { render json: @object } f.html { - redirect_to(params[:return_to] || :back) + if params[:return_to] + redirect_to(params[:return_to]) + else + redirect_back(fallback_location: root_path) + end } f.js { render } end @@ -519,7 +523,7 @@ class ApplicationController < ActionController::Base redirect_to arvados_api_client.arvados_login_url(return_to: strip_token_from_path(request.url)) else flash[:error] = "Either you are not logged in, or your session has timed out. I can't automatically log you in and re-attempt this request." - redirect_to :back + redirect_back(fallback_location: root_path) end false # For convenience to return from callbacks end diff --git a/apps/workbench/app/controllers/user_agreements_controller.rb b/apps/workbench/app/controllers/user_agreements_controller.rb index bdfaa24033..5e530a657e 100644 --- a/apps/workbench/app/controllers/user_agreements_controller.rb +++ b/apps/workbench/app/controllers/user_agreements_controller.rb @@ -9,7 +9,11 @@ class UserAgreementsController < ApplicationController def index if unsigned_user_agreements.empty? - redirect_to(params[:return_to] || :back) + if params[:return_to] + redirect_to(params[:return_to]) + else + redirect_back(fallback_location: root_path) + end end end @@ -24,6 +28,10 @@ class UserAgreementsController < ApplicationController end end current_user.activate - redirect_to(params[:return_to] || :back) + if params[:return_to] + redirect_to(params[:return_to]) + else + redirect_back(fallback_location: root_path) + end end end