Always allow the performance bar to be enabled for admins
This commit is contained in:
parent
2f17b4cb78
commit
eb9e09bb1a
2 changed files with 7 additions and 0 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue