diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-06 18:08:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-06 18:08:52 +0300 |
commit | 7b69a22d499787378aa30561822ef797a99c22e5 (patch) | |
tree | 630c757f4b55abd7ee445def6577587ec57e860d /app/finders | |
parent | d75e21489f113731bfe02b6c88e58879b5859103 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/protected_branches_finder.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/finders/protected_branches_finder.rb b/app/finders/protected_branches_finder.rb index a452a1f993b..dfc9a64737d 100644 --- a/app/finders/protected_branches_finder.rb +++ b/app/finders/protected_branches_finder.rb @@ -11,15 +11,21 @@ class ProtectedBranchesFinder LIMIT = 100 - attr_accessor :project, :params + attr_accessor :project_or_group, :params - def initialize(project, params = {}) - @project = project + def initialize(project_or_group, params = {}) + @project_or_group = project_or_group @params = params end def execute - protected_branches = project.limited_protected_branches(LIMIT) + protected_branches = if project_or_group.is_a?(Group) + project_or_group.protected_branches + else + project_or_group.all_protected_branches + end + + protected_branches = protected_branches.limit(LIMIT) by_name(protected_branches) end |