18577: workbench1: remove references to `redirect_to :back`, this
authorWard Vandewege <ward@curii.com>
Wed, 5 Jan 2022 19:34:45 +0000 (14:34 -0500)
committerWard Vandewege <ward@curii.com>
Wed, 5 Jan 2022 19:34:45 +0000 (14:34 -0500)
       stopped working in Rails 5.1.

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

apps/workbench/app/controllers/actions_controller.rb
apps/workbench/app/controllers/application_controller.rb
apps/workbench/app/controllers/user_agreements_controller.rb

index b0b7a0b64de19135ff084fac61ad44fc2c32d835..3667d8acaa5975fdb9c2bec62e1572667f13e680 100644 (file)
@@ -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
index 04055f84852ed4628aaf5a9d32ea79d72c59907f..5312e733f41eb992131752ccf782e112b8c5af2e 100644 (file)
@@ -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
index bdfaa240335922e3b616bf4c10d791f34ded70ac..5e530a657e6e9474c661a0479cd60a245dd2b1d2 100644 (file)
@@ -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