summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Maes <jaspermaes.jm@gmail.com>2018-12-17 18:36:09 +0100
committerJasper Maes <jaspermaes.jm@gmail.com>2019-01-02 19:48:07 +0100
commitfbdb46358098bb32a33bfd8e6d6b286c415cfe04 (patch)
tree09ea952ba3bd3667936a0b328243c40d32a43545
parentbf38936fb34e18e18cb4ed81f4fb35ac9420bfd6 (diff)
downloadgitlab-ce-fbdb46358098bb32a33bfd8e6d6b286c415cfe04.tar.gz
Fix deprecation: redirect_to :back is deprecated
-rw-r--r--app/controllers/admin/application_settings_controller.rb2
-rw-r--r--app/controllers/application_controller.rb2
-rw-r--r--app/controllers/sherlock/transactions_controller.rb2
-rw-r--r--changelogs/unreleased/deprecated-redirect-back.yml5
4 files changed, 8 insertions, 3 deletions
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb
index 8f683ca06ad..8f267eccc8a 100644
--- a/app/controllers/admin/application_settings_controller.rb
+++ b/app/controllers/admin/application_settings_controller.rb
@@ -77,7 +77,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
def reset_health_check_token
@application_setting.reset_health_check_access_token!
flash[:notice] = 'New health check access token has been generated!'
- redirect_to :back
+ redirect_back_or_default
end
def clear_repository_check_states
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 140a625d333..a8fc848c879 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -76,7 +76,7 @@ class ApplicationController < ActionController::Base
end
def redirect_back_or_default(default: root_path, options: {})
- redirect_to request.referer.present? ? :back : default, options
+ redirect_back(fallback_location: default, **options)
end
def not_found
diff --git a/app/controllers/sherlock/transactions_controller.rb b/app/controllers/sherlock/transactions_controller.rb
index 46e382e594e..8d1847507cc 100644
--- a/app/controllers/sherlock/transactions_controller.rb
+++ b/app/controllers/sherlock/transactions_controller.rb
@@ -15,7 +15,7 @@ module Sherlock
def destroy_all
Gitlab::Sherlock.collection.clear
- redirect_to :back, status: :found
+ redirect_back_or_default(options: { status: :found })
end
end
end
diff --git a/changelogs/unreleased/deprecated-redirect-back.yml b/changelogs/unreleased/deprecated-redirect-back.yml
new file mode 100644
index 00000000000..7fc567fbdb5
--- /dev/null
+++ b/changelogs/unreleased/deprecated-redirect-back.yml
@@ -0,0 +1,5 @@
+---
+title: 'Fix deprecation: redirect_to :back is deprecated'
+merge_request: 23943
+author: Jasper Maes
+type: other