summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-04 15:10:58 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-04 15:10:58 +0000
commit99373ac711072bf8f3ea7c020cd240b73dbc2ba3 (patch)
treeaf54150717a8b53c4563a98822f194240aa1b590 /app/controllers
parenteef37e3313a4f3413633d043e08d85020246ed5e (diff)
downloadgitlab-ce-99373ac711072bf8f3ea7c020cd240b73dbc2ba3.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/admin/applications_controller.rb3
-rw-r--r--app/controllers/concerns/oauth_applications.rb10
-rw-r--r--app/controllers/groups/settings/applications_controller.rb3
-rw-r--r--app/controllers/oauth/applications_controller.rb6
4 files changed, 22 insertions, 0 deletions
diff --git a/app/controllers/admin/applications_controller.rb b/app/controllers/admin/applications_controller.rb
index ce7d64336c8..83413afb6b7 100644
--- a/app/controllers/admin/applications_controller.rb
+++ b/app/controllers/admin/applications_controller.rb
@@ -15,6 +15,7 @@ class Admin::ApplicationsController < Admin::ApplicationController
end
def show
+ @created = get_created_session
end
def new
@@ -33,6 +34,8 @@ class Admin::ApplicationsController < Admin::ApplicationController
if @application.persisted?
flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])
+ set_created_session
+
redirect_to admin_application_url(@application)
else
render :new
diff --git a/app/controllers/concerns/oauth_applications.rb b/app/controllers/concerns/oauth_applications.rb
index d2c746db12d..794307ebb0c 100644
--- a/app/controllers/concerns/oauth_applications.rb
+++ b/app/controllers/concerns/oauth_applications.rb
@@ -3,6 +3,8 @@
module OauthApplications
extend ActiveSupport::Concern
+ CREATED_SESSION_KEY = :oauth_applications_created
+
included do
before_action :prepare_scopes, only: [:create, :update]
end
@@ -15,6 +17,14 @@ module OauthApplications
end
end
+ def set_created_session
+ session[CREATED_SESSION_KEY] = true
+ end
+
+ def get_created_session
+ session.delete(CREATED_SESSION_KEY) || false
+ end
+
def load_scopes
@scopes ||= Doorkeeper.configuration.scopes
end
diff --git a/app/controllers/groups/settings/applications_controller.rb b/app/controllers/groups/settings/applications_controller.rb
index f05a96d7810..6388277e4dc 100644
--- a/app/controllers/groups/settings/applications_controller.rb
+++ b/app/controllers/groups/settings/applications_controller.rb
@@ -16,6 +16,7 @@ module Groups
end
def show
+ @created = get_created_session
end
def edit
@@ -27,6 +28,8 @@ module Groups
if @application.persisted?
flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])
+ set_created_session
+
redirect_to group_settings_application_url(@group, @application)
else
set_index_vars
diff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rb
index 81f188256ba..81084ffe38b 100644
--- a/app/controllers/oauth/applications_controller.rb
+++ b/app/controllers/oauth/applications_controller.rb
@@ -24,12 +24,18 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
set_index_vars
end
+ def show
+ @created = get_created_session
+ end
+
def create
@application = Applications::CreateService.new(current_user, application_params).execute(request)
if @application.persisted?
flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])
+ set_created_session
+
redirect_to oauth_application_url(@application)
else
set_index_vars