From: Tom Hughes Date: Sun, 2 Feb 2025 10:16:43 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/5585' X-Git-Tag: live~550 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/22761a9d1f1f0628971d607f14bbfa7f1f19ce94?hp=8f387236cee2e842f695b287ae8a85c365bddf9c Merge remote-tracking branch 'upstream/pull/5585' --- diff --git a/app/controllers/api/maps_controller.rb b/app/controllers/api/maps_controller.rb index 2aa25fdd7..9ba95c255 100644 --- a/app/controllers/api/maps_controller.rb +++ b/app/controllers/api/maps_controller.rb @@ -57,26 +57,12 @@ module Api nodes += Node.includes(:node_tags).find(nodes_to_fetch) unless nodes_to_fetch.empty? - visible_nodes = {} - @nodes = [] - nodes.each do |node| - if node.visible? - visible_nodes[node.id] = node - @nodes << node - end - end + @nodes = nodes.filter(&:visible?) - @ways = [] - way_ids = [] - ways.each do |way| - if way.visible? - way_ids << way.id - @ways << way - end - end + @ways = ways.filter(&:visible?) - @relations = Relation.nodes(visible_nodes.keys).visible + - Relation.ways(way_ids).visible + @relations = Relation.nodes(@nodes).visible + + Relation.ways(@ways).visible # we do not normally return the "other" partners referenced by an relation, # e.g. if we return a way A that is referenced by relation X, and there's