@@ -438,6 +438,7 @@ export async function handleReply($el) {
438
438
439
439
export function initRepoPullRequestReview ( ) {
440
440
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
441
442
( history . scrollRestoration != 'manual' ) && ( history . scrollRestoration = 'manual' ) ;
442
443
const commentDiv = $ ( window . location . hash ) ;
443
444
if ( commentDiv ) {
@@ -446,13 +447,13 @@ export function initRepoPullRequestReview() {
446
447
if ( groupID && groupID . startsWith ( 'code-comments-' ) ) {
447
448
const id = groupID . slice ( 14 ) ;
448
449
const ancestorDiffBox = commentDiv . closest ( '.diff-file-box' ) ;
449
- const ancestorDiffHeader = ancestorDiffBox . find ( '.diff-file-header' ) [ 0 ] ;
450
450
$ ( `#show-outdated-${ id } ` ) . addClass ( 'gt-hidden' ) ;
451
451
$ ( `#code-comments-${ id } ` ) . removeClass ( 'gt-hidden' ) ;
452
452
$ ( `#code-preview-${ id } ` ) . removeClass ( 'gt-hidden' ) ;
453
453
$ ( `#hide-outdated-${ id } ` ) . removeClass ( 'gt-hidden' ) ;
454
+ // if the comment box is folded, expand it
454
455
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 ) ;
456
457
}
457
458
commentDiv [ 0 ] . scrollIntoView ( {
458
459
behavior : 'auto' ,
0 commit comments