summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/finders/group_descendants_finder.rb14
-rw-r--r--app/models/concerns/group_descendant.rb3
2 files changed, 15 insertions, 2 deletions
diff --git a/app/finders/group_descendants_finder.rb b/app/finders/group_descendants_finder.rb
index a39e6dedd1e..d921e59d16f 100644
--- a/app/finders/group_descendants_finder.rb
+++ b/app/finders/group_descendants_finder.rb
@@ -96,9 +96,21 @@ class GroupDescendantsFinder
.search(params[:filter])
end
+ # When filtering we want all to preload all the ancestors upto the specified
+ # parent group.
+ #
+ # - root
+ # - subgroup
+ # - nested-group
+ # - project
+ #
+ # So when searching 'project', on the 'subgroup' page we want to preload
+ # 'nested-group' but not 'subgroup' or 'root'
def ancestors_for_groups(base_for_ancestors)
+ ancestors_for_parent = Gitlab::GroupHierarchy.new(Group.where(id: parent_group))
+ .base_and_ancestors
Gitlab::GroupHierarchy.new(base_for_ancestors)
- .base_and_ancestors.where.not(id: parent_group)
+ .base_and_ancestors.where.not(id: ancestors_for_parent)
end
def subgroups
diff --git a/app/models/concerns/group_descendant.rb b/app/models/concerns/group_descendant.rb
index f850f71d661..7bc555e11a6 100644
--- a/app/models/concerns/group_descendant.rb
+++ b/app/models/concerns/group_descendant.rb
@@ -14,7 +14,8 @@ module GroupDescendant
if parent && parent != hierarchy_top
expand_hierarchy_for_child(parent,
{ parent => hierarchy },
- hierarchy_top)
+ hierarchy_top,
+ preloaded)
else
hierarchy
end