diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /app/controllers/application_controller.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r-- | app/controllers/application_controller.rb | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 00b9fb1060d..07ecde1181f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -263,7 +263,6 @@ class ApplicationController < ActionController::Base headers['X-XSS-Protection'] = '1; mode=block' headers['X-UA-Compatible'] = 'IE=edge' headers['X-Content-Type-Options'] = 'nosniff' - headers[Gitlab::Metrics::RequestsRackMiddleware::FEATURE_CATEGORY_HEADER] = feature_category end def default_cache_headers @@ -456,19 +455,17 @@ class ApplicationController < ActionController::Base end def set_current_context(&block) - Gitlab::ApplicationContext.with_context( - # Avoid loading the auth_user again after the request. Otherwise calling - # `auth_user` again would also trigger the Warden callbacks again - user: -> { auth_user if strong_memoized?(:auth_user) }, + Gitlab::ApplicationContext.push( + user: -> { context_user }, project: -> { @project if @project&.persisted? }, namespace: -> { @group if @group&.persisted? }, caller_id: caller_id, remote_ip: request.ip, - feature_category: feature_category) do - yield - ensure - @current_context = Gitlab::ApplicationContext.current - end + feature_category: feature_category + ) + yield + ensure + @current_context = Gitlab::ApplicationContext.current end def set_locale(&block) @@ -542,6 +539,12 @@ class ApplicationController < ActionController::Base end end + # Avoid loading the auth_user again after the request. Otherwise calling + # `auth_user` again would also trigger the Warden callbacks again + def context_user + auth_user if strong_memoized?(:auth_user) + end + def caller_id "#{self.class.name}##{action_name}" end |