]> source.dussan.org Git - gitea.git/commitdiff
Fix JS error when opening to expanded code comment (#30463) (#30470)
authorGiteabot <teabot@gitea.io>
Sun, 14 Apr 2024 10:46:21 +0000 (18:46 +0800)
committerGitHub <noreply@github.com>
Sun, 14 Apr 2024 10:46:21 +0000 (18:46 +0800)
Backport #30463 by silverwind

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
web_src/js/features/repo-issue.js

index bb45c6ae577fdb0956c16dfb35c12896382fa9b8..1438caeb60a10d00f517844ff430f536a5f4344e 100644 (file)
@@ -435,12 +435,10 @@ export function initRepoPullRequestReview() {
           offset += $('.diff-detail-box').outerHeight() + $(diffHeader).outerHeight();
         }
 
-        document.getElementById(`show-outdated-${id}`).classList.add('tw-hidden');
-        document.getElementById(`code-comments-${id}`).classList.remove('tw-hidden');
-        document.getElementById(`code-preview-${id}`).classList.remove('tw-hidden');
-        document.getElementById(`hide-outdated-${id}`).classList.remove('tw-hidden');
+        hideElem(`#show-outdated-${id}`);
+        showElem(`#code-comments-${id}, #code-preview-${id}, #hide-outdated-${id}`);
         // if the comment box is folded, expand it
-        if (ancestorDiffBox.getAttribute('data-folded') === 'true') {
+        if (ancestorDiffBox?.getAttribute('data-folded') === 'true') {
           setFileFolding(ancestorDiffBox, ancestorDiffBox.querySelector('.fold-file'), false);
         }