[openstreetmap/openstreetmap-website] CRUD interface for moderation zones (PR #7148)

Pablo Brasero notifications at github.com
Tue Jul 7 15:50:36 UTC 2026


@pablobm commented on this pull request.



> +    const feature = readFormField(COORDINATES_FIELD_ID);
+    if (feature) {
+      startTerraDrawForEdit(draw, feature);
+      map.fitBounds(featureToBox(feature), { radius: 100 });
+    } else {
+      startTerraDrawForNew(draw);
+    }
+  }
+
+  function readFormField(fieldId) {
+    const target = document.getElementById(fieldId);
+    if (!target) {
+      throw new Error(`Could not find field with id ${fieldId}`);
+    }
+
+    const match = POSTGIS_LINE_POINTS_REGEXP.exec(target.value);

In which sense?

- As in: what if there's something else in the textarea?
    - I guess a moderator would have to fiddle with this for that to happen? In any case, this is just a quick safeguard to bail out quickly if something's amiss.
- As in: what if in the future we allow other shapes (eg: a multipolygon)
    - Then we can change this regexp. Should be obvious the moment we test it manually, which I hope we do if we allow something else!

Having said that, perhaps this should be more explicit about the issue. I have changed it to throw a descriptive exception instead of just returning.

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

Message ID: <openstreetmap/openstreetmap-website/pull/7148/review/4646775393 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260707/397fb725/attachment.htm>


More information about the rails-dev mailing list