Refactor GeoNode#projects to reuse existing scopes

parent 2a9ab657
...@@ -199,9 +199,9 @@ class GeoNode < ApplicationRecord ...@@ -199,9 +199,9 @@ class GeoNode < ApplicationRecord
if selective_sync_by_namespaces? if selective_sync_by_namespaces?
query = Gitlab::ObjectHierarchy.new(namespaces).base_and_descendants query = Gitlab::ObjectHierarchy.new(namespaces).base_and_descendants
Project.where(namespace_id: query.select(:id)) Project.in_namespace(query.select(:id))
elsif selective_sync_by_shards? elsif selective_sync_by_shards?
Project.where(repository_storage: selective_sync_shards) Project.within_shards(selective_sync_shards)
else else
Project.none Project.none
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