Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-01-16 21:13:31 +0300
committerRémy Coutable <remy@rymai.me>2018-01-17 15:56:05 +0300
commit28d39447c39981565cd0cdfad63dab5e5126e524 (patch)
tree8663a412652f1cf9bbd3c1e407c7fa4cbd3cd499 /app/controllers/concerns
parent612d2266253a37a4f56b053f4dc17dd4f351f0d6 (diff)
In development, allow the toggling of the performance bar
The performance bar is still displayed by default in development. Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/controllers/concerns')
-rw-r--r--app/controllers/concerns/with_performance_bar.rb15
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