Skip to content

Commit 63892e8

Browse files
committed
add condition
1 parent 08b8c0c commit 63892e8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

web_src/js/features/repo-issue.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,12 +445,15 @@ export function initRepoPullRequestReview() {
445445
const groupID = commentDiv.closest('div[id^="code-comments-"]').attr('id');
446446
if (groupID && groupID.startsWith('code-comments-')) {
447447
const id = groupID.slice(14);
448-
const ancestorDiffHeader = commentDiv.closest('.diff-file-box').children('.diff-file-header').eq(0)[0];
448+
const ancestorDiffBox = commentDiv.closest('.diff-file-box');
449+
const ancestorDiffHeader = ancestorDiffBox.find('.diff-file-header')[0];
449450
$(`#show-outdated-${id}`).addClass('gt-hidden');
450451
$(`#code-comments-${id}`).removeClass('gt-hidden');
451452
$(`#code-preview-${id}`).removeClass('gt-hidden');
452453
$(`#hide-outdated-${id}`).removeClass('gt-hidden');
453-
setFileFolding(ancestorDiffHeader.closest('.file-content'), ancestorDiffHeader.querySelector('.fold-file'), false);
454+
if (ancestorDiffBox.attr('data-folded') && ancestorDiffBox.attr('data-folded') === "true") {
455+
setFileFolding(ancestorDiffBox[0], ancestorDiffHeader.querySelector('.fold-file'), false);
456+
}
454457
commentDiv[0].scrollIntoView({
455458
behavior: 'auto',
456459
block: 'center',

0 commit comments

Comments
 (0)