File tree 2 files changed +13
-14
lines changed
2 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -909,13 +909,15 @@ export function parseGraphQLViewerPermission(
909
909
return ViewerPermission . Unknown ;
910
910
}
911
911
912
+ export function isFileInRepo ( repository : Repository , file : vscode . Uri ) : boolean {
913
+ return file . path . toLowerCase ( ) === repository . rootUri . path . toLowerCase ( ) ||
914
+ ( file . path . toLowerCase ( ) . startsWith ( repository . rootUri . path . toLowerCase ( ) ) &&
915
+ file . path . substring ( repository . rootUri . path . length ) . startsWith ( '/' ) ) ;
916
+ }
917
+
912
918
export function getRepositoryForFile ( gitAPI : GitApiImpl , file : vscode . Uri ) : Repository | undefined {
913
919
for ( const repository of gitAPI . repositories ) {
914
- if (
915
- file . path . toLowerCase ( ) === repository . rootUri . path . toLowerCase ( ) ||
916
- ( file . path . toLowerCase ( ) . startsWith ( repository . rootUri . path . toLowerCase ( ) ) &&
917
- file . path . substring ( repository . rootUri . path . length ) . startsWith ( '/' ) )
918
- ) {
920
+ if ( isFileInRepo ( repository , file ) ) {
919
921
return repository ;
920
922
}
921
923
}
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import { PullRequestOverviewPanel } from '../github/pullRequestOverview';
21
21
import {
22
22
CommentReactionHandler ,
23
23
createVSCodeCommentThreadForReviewThread ,
24
+ isFileInRepo ,
24
25
threadRange ,
25
26
updateCommentReviewState ,
26
27
updateCommentThreadLabel ,
@@ -378,15 +379,12 @@ export class ReviewCommentController
378
379
return true ;
379
380
}
380
381
381
- const currentWorkspace = vscode . workspace . getWorkspaceFolder ( thread . uri ) ;
382
- if ( ! currentWorkspace ) {
382
+
383
+ if ( ! isFileInRepo ( this . _repository , thread . uri ) ) {
383
384
return false ;
384
385
}
385
386
386
- if (
387
- thread . uri . scheme === currentWorkspace . uri . scheme &&
388
- thread . uri . fsPath . startsWith ( this . _repository . rootUri . fsPath )
389
- ) {
387
+ if ( thread . uri . scheme === this . _repository . rootUri . scheme ) {
390
388
return true ;
391
389
}
392
390
@@ -408,12 +406,11 @@ export class ReviewCommentController
408
406
}
409
407
}
410
408
411
- const currentWorkspace = vscode . workspace . getWorkspaceFolder ( document . uri ) ;
412
- if ( ! currentWorkspace ) {
409
+ if ( ! isFileInRepo ( this . _repository , document . uri ) ) {
413
410
return ;
414
411
}
415
412
416
- if ( document . uri . scheme === currentWorkspace . uri . scheme ) {
413
+ if ( document . uri . scheme === this . _repository . rootUri . scheme ) {
417
414
if ( ! this . _reposManager . activePullRequest ! . isResolved ( ) ) {
418
415
return ;
419
416
}
You can’t perform that action at this time.
0 commit comments