[openstreetmap/openstreetmap-website] display warning in new note form after too many anonymous notes (PR #5468)
Anton Khorev
notifications at github.com
Mon Jan 6 07:54:39 UTC 2025
> I imagined this would require storing an ‘anonymous visitor ID’ in the cookie
This thing already exists as session id in `_osm_session` cookie. And that's another option. Instead of managing the counter and its expiration date in javascript, you can make a request at some special endpoint after a note is successfully created here https://github.com/openstreetmap/openstreetmap-website/blob/97b14ce22a0c7d17bb0b303b3795297721bc31d4/app/assets/javascripts/index/new_note.js#L48
That request will increase the counter stored in `session` if necessary. After that `app/views/notes/new.html.erb` or its controller can check the counter value and display the message based on that.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5468#issuecomment-2572497552
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5468/c2572497552 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250105/5fd15a16/attachment-0001.htm>
More information about the rails-dev
mailing list