summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorJames Edwards-Jones <jedwardsjones@gitlab.com>2017-04-03 15:17:24 +0100
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2017-04-03 17:19:53 +0100
commit65f3d5062f081d8f8ebf727a3408650d90ec9711 (patch)
tree0246397bd1a234ce9f34b9145321a1c4e40c1cd4 /lib/api
parenta7c71c7f292c9cdf892f7d33dfb52d7e16af28e6 (diff)
downloadgitlab-ce-65f3d5062f081d8f8ebf727a3408650d90ec9711.tar.gz
Extract ProtectedRef Concern
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/entities.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 5954aea8041..e000e3e33d0 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -189,13 +189,13 @@ module API
expose :developers_can_push do |repo_branch, options|
project = options[:project]
- access_levels = project.protected_branches.matching(repo_branch.name).map(&:push_access_levels).flatten
+ access_levels = project.protected_branches.access_levels_for_ref(repo_branch.name, :push)
access_levels.any? { |access_level| access_level.access_level == Gitlab::Access::DEVELOPER }
end
expose :developers_can_merge do |repo_branch, options|
project = options[:project]
- access_levels = project.protected_branches.matching(repo_branch.name).map(&:merge_access_levels).flatten
+ access_levels = project.protected_branches.access_levels_for_ref(repo_branch.name, :merge)
access_levels.any? { |access_level| access_level.access_level == Gitlab::Access::DEVELOPER }
end
end