[openstreetmap/openstreetmap-website] changeset-page doesn't pan to changeset location when opened from links in rss-feed (#865)

Andy Allan notifications at github.com
Sat Feb 15 13:37:58 UTC 2025


gravitystorm left a comment (openstreetmap/openstreetmap-website#865)

This is also a problem with the notes comment feed, which contains links with fragments (targetting the comment id).

`curl https://www.openstreetmap.org/api/0.6/notes/feed?bbox=8.1706155,51.8144663,8.5269845,51.9737924`

```
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc=["http://purl.org/dc/elements/1.1/"](http://purl.org/dc/elements/1.1/)
xmlns:geo=["http://www.w3.org/2003/01/geo/wgs84_pos#"](http://www.w3.org/2003/01/geo/wgs84_pos#)
xmlns:georss=["http://www.georss.org/georss"](http://www.georss.org/georss)>
  <channel>
    <title>OpenStreetMap Notes</title>
    <description>A list of notes, reported, commented on or closed in
your area [(51.8144663|8.1706155) --
(51.9737924|8.5269845)]</description>
    <link>https://www.openstreetmap.org/</link>
    <item>
      <title>reactivated note (near 33415, Verl, Kreis Gütersloh, North
Rhine-Westphalia, Germany)</title>
      <link>https://www.openstreetmap.org/note/3741743#c10178362</link>
      <guid>https://www.openstreetmap.org/note/3741743#c10178362</guid>
      <description>
```

I believe the problem is here, when adding an object (e.g. Changeset or Note) to the map:

https://github.com/openstreetmap/openstreetmap-website/blob/5ca24de0d04bef18353d3f0ecdd069d0bca34ce2/app/assets/javascripts/index.js#L312-L315

This code decides whether to move the map to display the object. It will only move the map if there are not a hash fragment in the url (`!window.location.hash`). The implicit assumption here is that if there **is** a fragment, that the fragment is a location (e.g. `#map=0/0/0`. The bug is that there might be other hash fragments, such as a comment id.

cc @flohoff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/865#issuecomment-2660929224
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/issues/865/2660929224 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250215/cda9513e/attachment-0001.htm>


More information about the rails-dev mailing list