diff options
Diffstat (limited to 'app/finders/protected_branches_finder.rb')
-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 |