From: Anton Khorev Date: Tue, 25 Mar 2025 00:21:58 +0000 (+0300) Subject: Fix "undefined" comment when hiding resolved notes X-Git-Tag: live~33^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/da2535ebe48664d570523e1f8ab3d95c8c0bf603?ds=sidebyside Fix "undefined" comment when hiding resolved notes --- diff --git a/app/assets/javascripts/index/note.js b/app/assets/javascripts/index/note.js index e8fcca302..f0b7dae27 100644 --- a/app/assets/javascripts/index/note.js +++ b/app/assets/javascripts/index/note.js @@ -41,8 +41,11 @@ OSM.Note = function (map) { data = new URLSearchParams(); content.find("button[name]").prop("disabled", true); - if (name !== "subscribe" && name !== "unsubscribe" && name !== "reopen") { - data.set("text", content.find("textarea").val()); + if (name !== "subscribe" && name !== "unsubscribe") { + const textarea = content.find("textarea"); + if (textarea.length) { + data.set("text", textarea.val()); + } } fetch(url, { diff --git a/test/system/resolve_note_test.rb b/test/system/resolve_note_test.rb index f9c28a999..c4b02b040 100644 --- a/test/system/resolve_note_test.rb +++ b/test/system/resolve_note_test.rb @@ -86,6 +86,7 @@ class ResolveNoteTest < ApplicationSystemTestCase assert_content "Hidden note ##{note.id}" assert_no_content "