summaryrefslogtreecommitdiff
path: root/lib/api/entities.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-08-16 21:17:15 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2016-08-16 21:17:15 +0100
commit45953a4c598d23771079a1efbb69dba65e4e642c (patch)
treedc87b760a319b6bce4275eb91793fa6fe6610e88 /lib/api/entities.rb
parent5b52da9c32842849f0b6430a6a820fc7456b4841 (diff)
parentf7e08ad0de580e9f27ad5301542f2913c6bb2bff (diff)
downloadgitlab-ce-45953a4c598d23771079a1efbb69dba65e4e642c.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into pipeline-hooks-without-slack
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r--lib/api/entities.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index e8a3a6a9df0..055716ab1e3 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -130,12 +130,14 @@ module API
expose :developers_can_push do |repo_branch, options|
project = options[:project]
- project.protected_branches.matching(repo_branch.name).any? { |protected_branch| protected_branch.push_access_level.access_level == Gitlab::Access::DEVELOPER }
+ access_levels = project.protected_branches.matching(repo_branch.name).map(&:push_access_levels).flatten
+ access_levels.any? { |access_level| access_level.access_level == Gitlab::Access::DEVELOPER }
end
expose :developers_can_merge do |repo_branch, options|
project = options[:project]
- project.protected_branches.matching(repo_branch.name).any? { |protected_branch| protected_branch.merge_access_level.access_level == Gitlab::Access::DEVELOPER }
+ access_levels = project.protected_branches.matching(repo_branch.name).map(&:merge_access_levels).flatten
+ access_levels.any? { |access_level| access_level.access_level == Gitlab::Access::DEVELOPER }
end
end