Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/finders/group_descendants_finder.rb')
-rw-r--r--app/finders/group_descendants_finder.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/finders/group_descendants_finder.rb b/app/finders/group_descendants_finder.rb
index 3d9b6e94cc6..40d6be03a17 100644
--- a/app/finders/group_descendants_finder.rb
+++ b/app/finders/group_descendants_finder.rb
@@ -25,7 +25,7 @@ class GroupDescendantsFinder
def initialize(current_user: nil, parent_group:, params: {})
@current_user = current_user
@parent_group = parent_group
- @params = params.reverse_merge(non_archived: params[:archived].blank?)
+ @params = params.reverse_merge(non_archived: params[:archived].blank?, not_aimed_for_deletion: true)
end
def execute
@@ -110,8 +110,13 @@ class GroupDescendantsFinder
# rubocop: disable CodeReuse/ActiveRecord
def ancestors_of_groups(base_for_ancestors)
group_ids = base_for_ancestors.except(:select, :sort).select(:id)
- Gitlab::ObjectHierarchy.new(Group.where(id: group_ids))
- .base_and_ancestors(upto: parent_group.id)
+ groups = Group.where(id: group_ids)
+
+ if Feature.enabled?(:linear_group_descendants_finder_upto, current_user, default_enabled: :yaml)
+ groups.self_and_ancestors(upto: parent_group.id)
+ else
+ Gitlab::ObjectHierarchy.new(groups).base_and_ancestors(upto: parent_group.id)
+ end
end
# rubocop: enable CodeReuse/ActiveRecord