From 94d145e8d00a973744c0748adb4236c8831001a7 Mon Sep 17 00:00:00 2001 From: Eva Date: Fri, 19 May 2023 17:52:34 +0200 Subject: [PATCH] client/views: fix incorrectly 'checked' checkboxes When similar posts were found, the anonymous upload checkbox for that image would become checked, because we treat anything !== undefined as 'checked', and in post_upload_views.js we set 'anonymous' to a querySelector, which returns null on failure and not undefined. Treat null as 'unchecked' to fix this issue, and prevent future mistakes slipping past. --- client/js/util/views.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/js/util/views.js b/client/js/util/views.js index 38c98a13..1cbd371f 100644 --- a/client/js/util/views.js +++ b/client/js/util/views.js @@ -81,7 +81,7 @@ function makeCheckbox(options) { name: options.name, value: options.value, type: "checkbox", - checked: options.checked !== undefined ? options.checked : false, + checked: options.checked !== undefined && options.checked !== null ? options.checked : false, disabled: options.readonly, required: options.required, }),