in app/models/concerns/group_descendant.rb [36:70]
def expand_hierarchy_for_child(child, hierarchy, hierarchy_top, preloaded)
parent = hierarchy_top if hierarchy_top && child.parent_id == hierarchy_top.id
parent ||= preloaded.detect { |possible_parent| possible_parent.is_a?(Group) && possible_parent.id == child.parent_id }
if parent.nil? && !child.parent_id.nil?
parent = child.parent
exception = ArgumentError.new <<~MSG
Parent was not preloaded for child when rendering group hierarchy.
This error is not user facing, but causes a +1 query.
MSG
extras = {
parent: parent.inspect,
child: child.inspect,
preloaded: preloaded.map(&:full_path),
issue_url: 'https://gitlab.com/gitlab-org/gitlab-foss/issues/49404'
}
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(exception, extras)
end
if parent.nil? && hierarchy_top.present?
raise ArgumentError.new(_('specified top is not part of the tree'))
end
if parent && parent != hierarchy_top
expand_hierarchy_for_child(parent,
{ parent => hierarchy },
hierarchy_top,
preloaded)
else
hierarchy
end
end