File tree Expand file tree Collapse file tree 1 file changed +24
-4
lines changed
Expand file tree Collapse file tree 1 file changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -1461,10 +1461,30 @@ export class FolderRepositoryManager extends Disposable {
14611461 }
14621462
14631463 async getMaxIssue ( repository : Repository ) : Promise < number > {
1464- const ghRepo = this . _githubRepositories . find ( repo =>
1465- repository . state . remotes . some ( r => r . name === repo . remote . remoteName )
1466- ) ;
1467- return ( await ghRepo ?. getMaxIssue ( ) ) ?? 0 ;
1464+ const remoteNames = new Set ( repository . state . remotes . map ( remote => remote . name ) ) ;
1465+ const ghRepo = this . _githubRepositories . find ( repo => remoteNames . has ( repo . remote . remoteName ) ) ;
1466+ if ( ! ghRepo ) {
1467+ return 0 ;
1468+ }
1469+
1470+ const reposToCheck : GitHubRepository [ ] = [ ghRepo ] ;
1471+ const metadata = await ghRepo . getMetadata ( ) ;
1472+ if ( metadata . fork ) {
1473+ for ( const repo of this . _githubRepositories ) {
1474+ if ( repo !== ghRepo && repo . remote . repositoryName === ghRepo . remote . repositoryName ) {
1475+ reposToCheck . push ( repo ) ;
1476+ }
1477+ }
1478+ }
1479+
1480+ const maxIssues = await Promise . all ( reposToCheck . map ( repo => repo . getMaxIssue ( ) ) ) ;
1481+ let max = 0 ;
1482+ for ( const value of maxIssues ) {
1483+ if ( value !== undefined ) {
1484+ max = Math . max ( max , value ) ;
1485+ }
1486+ }
1487+ return max ;
14681488 }
14691489
14701490 async getIssueTemplates ( ) : Promise < vscode . Uri [ ] > {
You can’t perform that action at this time.
0 commit comments