diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-09-21 10:20:37 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-04 23:49:41 +0300 |
commit | e13753fcaa4901a840f6b33bf9e1a06185c3ba10 (patch) | |
tree | 9060e690420ca99fd413056e6b9ec90eb63cd59a | |
parent | 29df1ce84198801863fd1890b14099d13c6ec7fb (diff) |
Only take unarchived projects into account
When finding children for a group
-rw-r--r-- | app/finders/group_descendants_finder.rb | 4 | ||||
-rw-r--r-- | spec/finders/group_descendants_finder_spec.rb | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/app/finders/group_descendants_finder.rb b/app/finders/group_descendants_finder.rb index 3b891effd0c..33fb1bf0359 100644 --- a/app/finders/group_descendants_finder.rb +++ b/app/finders/group_descendants_finder.rb @@ -6,7 +6,7 @@ class GroupDescendantsFinder def initialize(current_user: nil, parent_group:, params: {}) @current_user = current_user @parent_group = parent_group - @params = params + @params = params.reverse_merge(non_archived: true) end def execute @@ -74,7 +74,7 @@ class GroupDescendantsFinder end def projects_matching_filter - ProjectsFinder.new(current_user: current_user).execute + ProjectsFinder.new(current_user: current_user, params: params).execute .search(params[:filter]) .where(namespace: all_descendant_groups) end diff --git a/spec/finders/group_descendants_finder_spec.rb b/spec/finders/group_descendants_finder_spec.rb index c1268a486cf..77401ba09a2 100644 --- a/spec/finders/group_descendants_finder_spec.rb +++ b/spec/finders/group_descendants_finder_spec.rb @@ -19,6 +19,12 @@ describe GroupDescendantsFinder do expect(finder.execute).to contain_exactly(project) end + it 'does not include archived projects' do + _archived_project = create(:project, :archived, namespace: group) + + expect(finder.execute).to be_empty + end + context 'with a filter' do let(:params) { { filter: 'test' } } |