1
1
mirror of https://github.com/go-gitea/gitea synced 2024-05-28 23:15:48 +00:00

Fix JS error when opening to expanded code comment (#30463)

Fix regression from
e0b018706f
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>
This commit is contained in:
silverwind 2024-04-14 09:16:03 +02:00 committed by GitHub
parent b18c04ebde
commit ce130ae8da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -449,12 +449,10 @@ export function initRepoPullRequestReview() {
offset += $('.diff-detail-box').outerHeight() + $(diffHeader).outerHeight(); offset += $('.diff-detail-box').outerHeight() + $(diffHeader).outerHeight();
} }
document.getElementById(`show-outdated-${id}`).classList.add('tw-hidden'); hideElem(`#show-outdated-${id}`);
document.getElementById(`code-comments-${id}`).classList.remove('tw-hidden'); showElem(`#code-comments-${id}, #code-preview-${id}, #hide-outdated-${id}`);
document.getElementById(`code-preview-${id}`).classList.remove('tw-hidden');
document.getElementById(`hide-outdated-${id}`).classList.remove('tw-hidden');
// if the comment box is folded, expand it // 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); setFileFolding(ancestorDiffBox, ancestorDiffBox.querySelector('.fold-file'), false);
} }