summaryrefslogtreecommitdiff
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-05-17 13:20:55 +0200
committerRémy Coutable <remy@rymai.me>2017-06-09 17:21:39 +0200
commitd39ecf1ca7e9455abcdeb17c251a2d248a47d471 (patch)
tree51c448694d2e5a29083555a1d78b34f17fd57ef7 /app/controllers/application_controller.rb
parent320590180703c620cedd6eb6023548dca2d026cf (diff)
downloadgitlab-ce-d39ecf1ca7e9455abcdeb17c251a2d248a47d471.tar.gz
New performance bar that can be enabled with the `p b` shortcut
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 47ce21d238b..01b1462d5ec 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -18,7 +18,7 @@ class ApplicationController < ActionController::Base
before_action :ldap_security_check
before_action :sentry_context
before_action :default_headers
- before_action :add_gon_variables
+ before_action :add_gon_variables, unless: -> { request.path.start_with?('/peek') }
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :require_email, unless: :devise_controller?
@@ -63,6 +63,19 @@ class ApplicationController < ActionController::Base
end
end
+ def peek_enabled?
+ return false unless Gitlab::PerformanceBar.enabled?
+ return false unless current_user
+
+ if RequestStore.active?
+ if RequestStore.store.key?(:peek_enabled)
+ RequestStore.store[:peek_enabled]
+ else
+ RequestStore.store[:peek_enabled] = cookies[:perf_bar_enabled].present?
+ end
+ end
+ end
+
protected
# This filter handles both private tokens and personal access tokens