Skip to content

Commit ce130ae

Browse files
Fix JS error when opening to expanded code comment (go-gitea#30463)
Fix regression from go-gitea@e0b0187 where opening to a code comment via hash link would give this error: <img width="1247" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/f9aaeded-8492-4416-9a73-afa0c56220a7"> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
1 parent b18c04e commit ce130ae

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

web_src/js/features/repo-issue.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -449,12 +449,10 @@ export function initRepoPullRequestReview() {
449449
offset += $('.diff-detail-box').outerHeight() + $(diffHeader).outerHeight();
450450
}
451451

452-
document.getElementById(`show-outdated-${id}`).classList.add('tw-hidden');
453-
document.getElementById(`code-comments-${id}`).classList.remove('tw-hidden');
454-
document.getElementById(`code-preview-${id}`).classList.remove('tw-hidden');
455-
document.getElementById(`hide-outdated-${id}`).classList.remove('tw-hidden');
452+
hideElem(`#show-outdated-${id}`);
453+
showElem(`#code-comments-${id}, #code-preview-${id}, #hide-outdated-${id}`);
456454
// if the comment box is folded, expand it
457-
if (ancestorDiffBox.getAttribute('data-folded') === 'true') {
455+
if (ancestorDiffBox?.getAttribute('data-folded') === 'true') {
458456
setFileFolding(ancestorDiffBox, ancestorDiffBox.querySelector('.fold-file'), false);
459457
}
460458

0 commit comments

Comments
 (0)