Merge branch 'rs-performance-bar-for-admins' into 'master'

Always allow the performance bar to be enabled for admins

See merge request gitlab-org/gitlab-ce!18137
This commit is contained in:
Rémy Coutable 2018-04-03 13:31:37 +00:00
commit 2e6e4ea80c
2 changed files with 7 additions and 0 deletions

View file

@ -5,6 +5,7 @@ module Gitlab
def self.enabled?(user = nil)
return true if Rails.env.development?
return true if user&.admin?
return false unless user && allowed_group_id
allowed_user_ids.include?(user.id)

View file

@ -25,6 +25,12 @@ describe Gitlab::PerformanceBar do
expect(described_class.enabled?(nil)).to be_falsy
end
it 'returns true when given user is an admin' do
user = build_stubbed(:user, :admin)
expect(described_class.enabled?(user)).to be_truthy
end
it 'returns false when allowed_group_id is nil' do
expect(described_class).to receive(:allowed_group_id).and_return(nil)