diff options
Diffstat (limited to 'app/controllers/concerns/with_performance_bar.rb')
-rw-r--r-- | app/controllers/concerns/with_performance_bar.rb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/app/controllers/concerns/with_performance_bar.rb b/app/controllers/concerns/with_performance_bar.rb index 230bbe4b1aa..6a8b1a4de7b 100644 --- a/app/controllers/concerns/with_performance_bar.rb +++ b/app/controllers/concerns/with_performance_bar.rb @@ -6,13 +6,22 @@ module WithPerformanceBar end def peek_enabled? - return true if Rails.env.development? return false unless Gitlab::PerformanceBar.enabled?(current_user) if RequestStore.active? - RequestStore.fetch(:peek_enabled) { cookies[:perf_bar_enabled].present? } + RequestStore.fetch(:peek_enabled) { cookie_or_default_value } else - cookies[:perf_bar_enabled].present? + cookie_or_default_value + end + end + + private + + def cookie_or_default_value + if cookies[:perf_bar_enabled].present? + cookies[:perf_bar_enabled] == 'true' + else + cookies[:perf_bar_enabled] = 'true' if Rails.env.development? end end end |