[openstreetmap/openstreetmap-website] Fix "undefined" comment when hiding resolved notes (PR #5842)

Anton Khorev notifications at github.com
Tue Mar 25 22:07:32 UTC 2025


@AntonKhorev commented on this pull request.



> +        const textarea = content.find("textarea");
+        if (textarea.length) {
+          data.set("text", textarea.val());
+        }

I guess @hlfan wants to say that the OSM API reacts the same to empty `text` parameters and missing `text` parameters. Internally it's not true because note comment body is nullable. On the other hand we are unlikely to make a distinction between "" and null when we'll be deciding if what's currently stored as a comment is a real comment or not. And the following line is also ignoring this distinction because the comment model creates a `RichText` object even for null-comments:

https://github.com/openstreetmap/openstreetmap-website/blob/f1686b59cd92d2af077d49ef41440bc581016ac8/app/views/api/notes/_note.xml.builder#L30

This `if` is always true.

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

Message ID: <openstreetmap/openstreetmap-website/pull/5842/review/2715318134 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250325/85cbff27/attachment.htm>


More information about the rails-dev mailing list