]> source.dussan.org Git - gitea.git/commitdiff
Fix counter display number incorrectly displayed on the page (#29448)
authorcharles <30816317+charles7668@users.noreply.github.com>
Wed, 28 Feb 2024 20:23:49 +0000 (04:23 +0800)
committerGitHub <noreply@github.com>
Wed, 28 Feb 2024 20:23:49 +0000 (21:23 +0100)
issue : #28239

The counter number script uses the 'checkbox' attribute to determine
whether an item is selected or not.

However, the input event only increments the counter value, and when
more items are displayed, it does not update all previously loaded
items.

As a result, the display becomes incorrect because it triggers the
update counter script, but checkboxes that are selected without the
'checked' attribute are not counted

web_src/js/features/pull-view-file.js

index 90881ee98970ac9e7e4ed52d10957915020e8e5e..2472e5a0bd6c54f8f97f5d97d37e1b3261a40c68 100644 (file)
@@ -43,9 +43,11 @@ export function initViewedCheckboxListenerFor() {
       // Mark the file as viewed visually - will especially change the background
       if (this.checked) {
         form.classList.add(viewedStyleClass);
+        checkbox.setAttribute('checked', '');
         prReview.numberOfViewedFiles++;
       } else {
         form.classList.remove(viewedStyleClass);
+        checkbox.removeAttribute('checked');
         prReview.numberOfViewedFiles--;
       }