X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b7c171d2736140cfc8bbd30ae4911c8e52f5f07a..4197b2d008dc6b524b3f5f4ed632e581b6d74b51:/app/assets/javascripts/index/layers/notes.js diff --git a/app/assets/javascripts/index/layers/notes.js b/app/assets/javascripts/index/layers/notes.js index 75bd73bce..1bc3714f0 100644 --- a/app/assets/javascripts/index/layers/notes.js +++ b/app/assets/javascripts/index/layers/notes.js @@ -43,9 +43,16 @@ OSM.initializeNotesLayer = function (map) { if (marker) { marker.setIcon(noteIcons[feature.properties.status]); } else { + let title; + const description = feature.properties.comments[0]; + + if (description?.action === "opened") { + title = description.text; + } + marker = L.marker(feature.geometry.coordinates.reverse(), { icon: noteIcons[feature.properties.status], - title: feature.properties.comments[0].text, + title, opacity: 0.8, interactive: true }); @@ -77,9 +84,7 @@ OSM.initializeNotesLayer = function (map) { function success(json) { var oldNotes = notes; notes = {}; - json.features.forEach(updateMarkers); - - function updateMarkers(feature) { + for (const feature of json.features) { var marker = oldNotes[feature.properties.id]; delete oldNotes[feature.properties.id]; notes[feature.properties.id] = updateMarker(marker, feature);