Avoid JS error on issue/pr list when logged out (#29854)

When logged out, the checkboxes are not there on the issue/pr lists,
which would cause an error here.

Fixes: https://github.com/go-gitea/gitea/issues/29862

---------

Co-authored-by: delvh <dev.lh@web.de>
(cherry picked from commit 33973ac567d6681bda26d82f26b7294a297c693f)
This commit is contained in:
silverwind 2024-03-17 13:50:32 +01:00 committed by Earl Warren
parent 2141bc3298
commit 003d860aac
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -9,6 +9,7 @@ import {DELETE, POST} from '../modules/fetch.js';
function initRepoIssueListCheckboxes() { function initRepoIssueListCheckboxes() {
const issueSelectAll = document.querySelector('.issue-checkbox-all'); const issueSelectAll = document.querySelector('.issue-checkbox-all');
if (!issueSelectAll) return; // logged out state
const issueCheckboxes = document.querySelectorAll('.issue-checkbox'); const issueCheckboxes = document.querySelectorAll('.issue-checkbox');
const syncIssueSelectionState = () => { const syncIssueSelectionState = () => {