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

parent 455b9b6b
...@@ -133,9 +133,7 @@ class GeoNode < ActiveRecord::Base ...@@ -133,9 +133,7 @@ class GeoNode < ActiveRecord::Base
def projects def projects
if selective_sync? if selective_sync?
relations = namespaces.map { |namespace| namespace.all_projects.select(:id) } Project.where(namespace_id: Gitlab::GroupHierarchy.new(namespaces).base_and_descendants.select(:id))
Project.where("id IN (#{Gitlab::SQL::Union.new(relations).to_sql})") # rubocop:disable GitlabSecurity/SqlInjection
else else
Project.all Project.all
end 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