diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/finders/group_children_finder.rb | 6 | ||||
-rw-r--r-- | app/models/concerns/group_hierarchy.rb | 7 |
2 files changed, 8 insertions, 5 deletions
diff --git a/app/finders/group_children_finder.rb b/app/finders/group_children_finder.rb index eb0129947e2..bac3fb208d0 100644 --- a/app/finders/group_children_finder.rb +++ b/app/finders/group_children_finder.rb @@ -52,7 +52,7 @@ class GroupChildrenFinder end def subgroups_matching_filter - all_subgroups.search(params[:filter]).include(:parent) + all_subgroups.search(params[:filter]) end def subgroups @@ -64,7 +64,7 @@ class GroupChildrenFinder else base_groups end - groups = groups.includes(:route).includes(:children) + groups = groups groups.sort(params[:sort]) end @@ -75,7 +75,6 @@ class GroupChildrenFinder def projects_matching_filter ProjectsFinder.new(current_user: current_user).execute .search(params[:filter]) - .include(:namespace) .where(namespace: all_subgroups) end @@ -87,7 +86,6 @@ class GroupChildrenFinder else base_projects end - projects = projects.includes(:route) projects.sort(params[:sort]) end end diff --git a/app/models/concerns/group_hierarchy.rb b/app/models/concerns/group_hierarchy.rb index f7a62c9a607..9999bd87686 100644 --- a/app/models/concerns/group_hierarchy.rb +++ b/app/models/concerns/group_hierarchy.rb @@ -62,7 +62,12 @@ module GroupHierarchy # If both of them are hashes, we can deep_merge with the same logic elsif first_child.is_a?(Hash) && second_child.is_a?(Hash) first_child.deep_merge(second_child) { |key, first, second| merge_values(first, second) } - # One of them is a root node, we just need to put them next to eachother in an array + # If only one of them is a hash, we can check if the other child is already + # included, we don't need to do anything when it is. + elsif first_child.is_a?(Hash) && first_child.keys.include?(second_child) + first_child + elsif second_child.is_a?(Hash) && second_child.keys.include?(first_child) + second_child else Array.wrap(first_child) + Array.wrap(second_child) end |