[openstreetmap/openstreetmap-website] Consistent usage of layer information in _osm_location cookie (PR #5529)

mmd notifications at github.com
Tue Jan 21 17:27:22 UTC 2025


As reported in #3971, some URLs like https://www.openstreetmap.org/?mlat=53.32607&mlon=-1.49033 reset the currently selected layers. In order to restore the previous setting, a user needs to select both map and overlay layers after click on the link. 

It seems a bit premature to simply override the current layers, in case the link does not include any layer information.

Instead, this PR unconditionally extracts the current layers from the _osm_location cookie, so it can be applied consistently across different url parsing alterantives.

As before, if the link includes layers in the hash value, that information takes precedence.

This change mainly impacts line 144 below:

```
mapParams.layers = hash.layers || (loc && loc[3]) || '';
```

loc[3] will now always contain  the selected layers, as long as the cookie is available.





You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/5529

-- Commit Summary --

  * Consistent usage of layer information in _osm_location cookie

-- File Changes --

    M app/assets/javascripts/osm.js.erb (7)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/5529.patch
https://github.com/openstreetmap/openstreetmap-website/pull/5529.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5529
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5529 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250121/3ec5234f/attachment.htm>


More information about the rails-dev mailing list