<h3 dir="auto">Motivation</h3>
<p dir="auto">In the French community, we've had a problem for over a year with someone creating a huge number of anonymous notes, which hampers the processing of other relevant notes in the same area. See <a href="https://forum.openstreetmap.fr/t/notes-anonymes-a-gogo/18362" rel="nofollow">this discussion</a> on the French community forum.</p>
<p dir="auto">I thought it would be a good idea to count the number of anonymous notes created in the same browser and to display a warning when this number becomes too high, to encourage visitors to become users and contributors.</p>
<h3 dir="auto">Description</h3>
<p dir="auto">This PR creates a new warning in the UI of the new note form if an anonymous visitor has already created too many anonymous notes (threshold set at 20 for now)<br>
<a href="https://github.com/user-attachments/assets/4812efa9-f402-4601-aa9c-eb0ea969954f">image.png (view on web)</a></p>
<p dir="auto"><strong>Changes</strong>:</p>
<ul dir="auto">
<li>in template views/note/new.html.erb
<ul dir="auto">
<li>add a new div element displaying the warning (hidden at first)</li>
</ul>
</li>
<li>in locales/en.yml
<ul dir="auto">
<li>add text and links for the warning, with ‘(N)’ being replaced by the number of anonymous notes</li>
</ul>
</li>
<li>in new_note.js
<ul dir="auto">
<li>when an anonymous note is created: add +1 to the counter in localStorage</li>
<li>when the form is displayed: check the counter in localStorage. If more that 20 notes have already been created: display the warning, and replace (N) in the text warning with the number of anonymous notes already created.</li>
</ul>
</li>
</ul>
<p dir="auto"><strong>Possible additional change (not included yet)</strong><br>
After an even larger number of anonymous notes (50?), I thought we could hide the textarea, and trigger its display by clicking on a button <em>sure you want to post an anonymous note again?</em>, which would force the visitor to perform an additional action. This is not included in this PR yet, but tell me if you want me to add it.</p>
<h3 dir="auto">How has this been tested?</h3>
<p dir="auto">The code has been tested on my personal computer using rails built-in webserver. I verified that the new note form is still working fine both when logged in and in anonymous mode.</p>
<p dir="auto">However, as described in issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2769005360" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/5467" data-hovercard-type="issue" data-hovercard-url="/openstreetmap/openstreetmap-website/issues/5467/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/issues/5467">#5467</a> I was not able to make all the tests requested in <a href="https://github.com/openstreetmap/openstreetmap-website/blob/master/CONTRIBUTING.md">CONTRIBUTING.md</a>.</p>
<p dir="auto">As this is my very first PR, I'm not sure I've done everything right, so I welcome any relevant comments!</p>
<hr>
<h4>You can view, comment on, or merge this pull request online at:</h4>
<p> <a href='https://github.com/openstreetmap/openstreetmap-website/pull/5468'>https://github.com/openstreetmap/openstreetmap-website/pull/5468</a></p>
<h4>Commit Summary</h4>
<ul>
<li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/5468/commits/525027600cb13ec9779010e1268a8a63b74ea57c" class="commit-link">5250276</a> display warning in new note form after too many anonymous notes</li>
</ul>
<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5468/files">3 files</a>)</p>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5468/files#diff-08fd2f80528286cf96375b12d81cac98954dee8e6a6899f5f261a127861fdd49">app/assets/javascripts/index/new_note.js</a>
(13)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5468/files#diff-cb517058985c89ad2c4fa3503e6e5c62cc9953e2972bd6128c2f34156905f94f">app/views/notes/new.html.erb</a>
(5)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/5468/files#diff-44438ce218f5287c58d0017f965d888715635d94280669896f75841fbd7b4cd7">config/locales/en.yml</a>
(4)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5468.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/5468.patch</a></li>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/5468.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/5468.diff</a></li>
</ul>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/5468">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLNM73HYDQS7V75GQHT2JBTHPAVCNFSM6AAAAABUTQNBICVHI2DSMVQWIX3LMV43ASLTON2WKOZSG43DSMBTGUYTQOI">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLO6QJPPR6YMEJJMK732JBTHPA5CNFSM6AAAAABUTQNBICWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHKKDA7WU.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/5468</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/5468",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/5468",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>