openstreetmap / openstreetmap-website

The Rails application that powers OpenStreetMap
https://www.openstreetmap.org/
GNU General Public License v2.0
2.18k stars 914 forks source link

Notes controller calls set_locale after lookup_user which can cause unexpected language for 404 users notes #5251

Open Firefishy opened 3 days ago

Firefishy commented 3 days ago

URL

https://www.openstreetmap.org/user/Omaraltab/notes

How to reproduce the issue?

Refreshing the URL occasionally returns the 404 page in an unexpected language.

https://github.com/openstreetmap/openstreetmap-website/blob/acd899d26dbf09620d598d74759fc6f7aac4846a/app/controllers/notes_controller.rb#L12

Screenshot(s) or anything else?

Page unexpectedly in German:

Screenshot 2024-10-07 at 11 40 39
tomhughes commented 3 days ago

We probably need to review all the lookup_user calls and make sure they come after set_locale and probably web_timeout as well though that's unlikely to matter much.

mmd-osm commented 3 days ago

Related issue for API error messages: #2227

tomhughes commented 3 days ago

It's not really related at all though other than in the most tangential way.

mmd-osm commented 3 days ago

Right, I had another issue in mind where you would see error messages in whatever language that happens to be set previously. I can't find it at the moment...

Edit: I think it was #1702