Use Gitlab::GroupHierarchy rather than Gitlab::SQL::Union

parent 455b9b6b
......@@ -133,9 +133,7 @@ class GeoNode < ActiveRecord::Base
def projects
if selective_sync?
relations = namespaces.map { |namespace| namespace.all_projects.select(:id) }
Project.where("id IN (#{Gitlab::SQL::Union.new(relations).to_sql})") # rubocop:disable GitlabSecurity/SqlInjection
Project.where(namespace_id: Gitlab::GroupHierarchy.new(namespaces).base_and_descendants.select(:id))
else
Project.all
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment