[openstreetmap/openstreetmap-website] only parse hashParams if there actually is a hash (PR #3571)

Martin Raifer notifications at github.com
Tue Jun 14 18:45:53 UTC 2022


Presumably this was an oversight in the original implementation: `OSM.params` falls back to the page's `query` string if the function's parameter (here: the page's `hash`) is an empty string.

This fixes some inconsistent behaviour of the website. In the example below, the first URL sets the `background` to `none` while in the second example it doesn't.

* https://www.openstreetmap.org/edit.html?background=none
* https://www.openstreetmap.org/edit.html?background=none#map=…

With this PR, the `background` query parameter is ignored in both examples. The correct way to supply the `background` (and [related parameters](https://github.com/openstreetmap/openstreetmap-website/blob/c55d346/app/assets/javascripts/edit/id.js.erb#L23-L39)) is via a hash parameter:

* https://www.openstreetmap.org/edit.html#background=none
* https://www.openstreetmap.org/edit.html#background=none&map=…
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * only parse hashParams if there is a hash

-- File Changes --

    M app/assets/javascripts/edit/id.js.erb (3)

-- Patch Links --

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

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

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


More information about the rails-dev mailing list