summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorJames Edwards-Jones <jedwardsjones@gitlab.com>2017-04-04 01:39:34 +0100
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2017-04-04 01:39:34 +0100
commit90c8bb8301b4bc3268a5fa4ea8bddafbc29d6871 (patch)
treeb2a7f7b7c78e819659a6ef3462164cd7814fa6ec /lib/api
parentd5acb69e116cbbed105e29552d7cca2e864f0c8f (diff)
downloadgitlab-ce-90c8bb8301b4bc3268a5fa4ea8bddafbc29d6871.tar.gz
Fixed developers_can_push in RepoBranch API entity
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/entities.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 0fe7eb864e4..0cc6188938d 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -188,15 +188,11 @@ module API
end
expose :developers_can_push do |repo_branch, options|
- project = options[:project]
- 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 }
+ options[:project].protected_branches.developers_can?(:push, repo_branch.name)
end
expose :developers_can_merge do |repo_branch, options|
- project = options[:project]
- 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 }
+ options[:project].protected_branches.developers_can?(:merge, repo_branch.name)
end
end