Skip to content

Commit 40dc855

Browse files
committed
add comments
1 parent 63892e8 commit 40dc855

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

web_src/js/features/repo-issue.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ export async function handleReply($el) {
438438

439439
export function initRepoPullRequestReview() {
440440
if (window.location.hash && window.location.hash.startsWith('#issuecomment-')) {
441+
// set scrollRestoration to 'manual' when there is a hash in url, so that position will not be remembered after refreshing
441442
(history.scrollRestoration != 'manual') && (history.scrollRestoration = 'manual');
442443
const commentDiv = $(window.location.hash);
443444
if (commentDiv) {
@@ -446,13 +447,13 @@ export function initRepoPullRequestReview() {
446447
if (groupID && groupID.startsWith('code-comments-')) {
447448
const id = groupID.slice(14);
448449
const ancestorDiffBox = commentDiv.closest('.diff-file-box');
449-
const ancestorDiffHeader = ancestorDiffBox.find('.diff-file-header')[0];
450450
$(`#show-outdated-${id}`).addClass('gt-hidden');
451451
$(`#code-comments-${id}`).removeClass('gt-hidden');
452452
$(`#code-preview-${id}`).removeClass('gt-hidden');
453453
$(`#hide-outdated-${id}`).removeClass('gt-hidden');
454+
// if the comment box is folded, expand it
454455
if (ancestorDiffBox.attr('data-folded') && ancestorDiffBox.attr('data-folded') === "true") {
455-
setFileFolding(ancestorDiffBox[0], ancestorDiffHeader.querySelector('.fold-file'), false);
456+
setFileFolding(ancestorDiffBox[0], ancestorDiffBox[0].querySelector('.fold-file'), false);
456457
}
457458
commentDiv[0].scrollIntoView({
458459
behavior: 'auto',

0 commit comments

Comments
 (0)