]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/new_note.js
display an encouragement to contribute after many anonymous notes
[rails.git] / app / assets / javascripts / index / new_note.js
index 885d7d2c994b22f5a35b27d1143b5df3254fa75e..4f38f8b55754267eab293788c51793df986a3064 100644 (file)
@@ -162,6 +162,10 @@ OSM.NewNote = function (map) {
       newNoteMarker.dragging.disable();
 
       createNote(location, text, (feature) => {
+        if (typeof OSM.user === "undefined") {
+          var anonymousNotesCount = Number(Cookies.get("_osm_anonymous_notes_count")) || 0;
+          Cookies.set("_osm_anonymous_notes_count", anonymousNotesCount + 1, { secure: true, expires: 30, path: "/", samesite: "lax" });
+        }
         content.find("textarea").val("");
         addCreatedNoteMarker(feature);
         OSM.router.route("/note/" + feature.properties.id);