Avoid Preloading nil root_ancestor in ProjectRootAncestorPreloader
What does this MR do and why?
The ProjectRootAncestorPreloader
preloads a nil
value for project.namespace.root_ancestor
when it is passed projects in a user namespace with a :group
STI name.
In other words, if it is invoked like ::Preloaders::ProjectRootAncestorPreloader.new(projects, :group).execute
then any projects
in a user namespace will end up with project.namespace.root_ancestor
equal to nil
.
This MR fixes the issue so that in this scenario, nothing is preloaded for the namespace.
More generally, if in any scenario the preloaded value for project.namespace.root_ancestor
would be nil
, then nothing is preloaded.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Jason Goodman