]> git.openstreetmap.org Git - rails.git/commitdiff
Update arguments of data overlay interestingNode()
authorAnton Khorev <tony29@yandex.ru>
Tue, 7 Jan 2025 08:26:15 +0000 (11:26 +0300)
committerAnton Khorev <tony29@yandex.ru>
Tue, 7 Jan 2025 08:26:15 +0000 (11:26 +0300)
app/assets/javascripts/leaflet.map.js
test/system/browse_test.rb [new file with mode: 0644]

index 5e6112fc057e16ec7566a83ea8a8e2e0b52a4680..e0c2ee60b47fb0ddd5251ac520b3c8e234f8ebca 100644 (file)
@@ -312,13 +312,11 @@ L.OSM.Map = L.Map.extend({
             }
           });
 
-          map._objectLayer.interestingNode = function (node, ways, relations) {
+          map._objectLayer.interestingNode = function (node, wayNodes, relationNodes) {
             if (object.type === "node") {
               return true;
             } else if (object.type === "relation") {
-              for (var i = 0; i < relations.length; i++) {
-                if (relations[i].members.indexOf(node) !== -1) return true;
-              }
+              return Boolean(relationNodes[node.id]);
             } else {
               return false;
             }
diff --git a/test/system/browse_test.rb b/test/system/browse_test.rb
new file mode 100644 (file)
index 0000000..15dc1cb
--- /dev/null
@@ -0,0 +1,13 @@
+require "application_system_test_case"
+
+class BrowseTest < ApplicationSystemTestCase
+  test "relation member nodes should be visible on the map when viewing relations" do
+    relation = create(:relation)
+    node = create(:node)
+    create(:relation_member, :relation => relation, :member => node)
+
+    visit relation_path(relation)
+
+    assert_selector "#map .leaflet-overlay-pane path"
+  end
+end