Commit 91490dca authored by Baodong Cao's avatar Baodong Cao Committed by Heinrich Lee Yu

Refactor performance bar cookie check

Refactors the method to make the intent clearer

Changelog: changed
MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/62675
parent 0470e3ad
......@@ -20,12 +20,11 @@ module WithPerformanceBar
end
def cookie_or_default_value
cookie_enabled = if cookies[:perf_bar_enabled].present?
cookies[:perf_bar_enabled] == 'true'
else
cookies[:perf_bar_enabled] = 'true' if Rails.env.development?
end
if cookies[:perf_bar_enabled].blank? && Rails.env.development?
cookies[:perf_bar_enabled] = 'true'
end
cookie_enabled = cookies[:perf_bar_enabled] == 'true'
cookie_enabled && Gitlab::PerformanceBar.allowed_for_user?(current_user)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment