diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-03-07 01:30:47 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-03-07 18:59:17 +0300 |
commit | 9aabd8fd5ecb4090515db48692f3d064624aec0a (patch) | |
tree | 318418b94d97bc846e6e00ed782181cfd26e9487 /lib/gitlab/user_access.rb | |
parent | 9b27027619580bffeffa88965007c2c29ac9648c (diff) |
Limit queries to a user-branch combination
The query becomes a lot simpler if we can check the branch name as
well instead of having to load all branch names.
Diffstat (limited to 'lib/gitlab/user_access.rb')
-rw-r--r-- | lib/gitlab/user_access.rb | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/gitlab/user_access.rb b/lib/gitlab/user_access.rb index fa32776d9f8..fd68b9f2b48 100644 --- a/lib/gitlab/user_access.rb +++ b/lib/gitlab/user_access.rb @@ -70,10 +70,8 @@ module Gitlab protected_branch_accessible_to?(ref, action: :push) elsif user.can?(:push_code, project) true - elsif user.can?(:push_single_branch, project) - project.branches_allowing_maintainer_access_to_user(user).include?(ref) else - false + project.branch_allows_maintainer_push?(user, ref) end end |