File tree Expand file tree Collapse file tree 2 files changed +23
-11
lines changed
Expand file tree Collapse file tree 2 files changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -1462,16 +1462,28 @@ export class FolderRepositoryManager extends Disposable {
14621462 }
14631463 }
14641464
1465- async getMaxIssue ( ) : Promise < number > {
1466- const maxIssues = await Promise . all (
1467- this . _githubRepositories . map ( repository => {
1468- return repository . getMaxIssue ( ) ;
1469- } ) ,
1470- ) ;
1471- let max : number = 0 ;
1472- for ( const issueNumber of maxIssues ) {
1473- if ( issueNumber !== undefined ) {
1474- max = Math . max ( max , issueNumber ) ;
1465+ async getMaxIssue ( repository : Repository ) : Promise < number > {
1466+ const remoteNames = new Set ( repository . state . remotes . map ( remote => remote . name ) ) ;
1467+ const ghRepo = this . _githubRepositories . find ( repo => remoteNames . has ( repo . remote . remoteName ) ) ;
1468+ if ( ! ghRepo ) {
1469+ return 0 ;
1470+ }
1471+
1472+ const reposToCheck : GitHubRepository [ ] = [ ghRepo ] ;
1473+ const metadata = await ghRepo . getMetadata ( ) ;
1474+ if ( metadata . fork ) {
1475+ for ( const repo of this . _githubRepositories ) {
1476+ if ( repo !== ghRepo && repo . remote . repositoryName === ghRepo . remote . repositoryName ) {
1477+ reposToCheck . push ( repo ) ;
1478+ }
1479+ }
1480+ }
1481+
1482+ const maxIssues = await Promise . all ( reposToCheck . map ( repo => repo . getMaxIssue ( ) ) ) ;
1483+ let max = 0 ;
1484+ for ( const value of maxIssues ) {
1485+ if ( value !== undefined ) {
1486+ max = Math . max ( max , value ) ;
14751487 }
14761488 }
14771489 return max ;
Original file line number Diff line number Diff line change @@ -342,7 +342,7 @@ export class StateManager {
342342 singleRepoState . issueCollection . set ( query . label , items ) ;
343343 }
344344 }
345- singleRepoState . maxIssueNumber = await folderManager . getMaxIssue ( ) ;
345+ singleRepoState . maxIssueNumber = await folderManager . getMaxIssue ( folderManager . repository ) ;
346346 singleRepoState . lastHead = folderManager . repository . state . HEAD ?. commit ;
347347 singleRepoState . lastBranch = folderManager . repository . state . HEAD ?. name ;
348348 }
You can’t perform that action at this time.
0 commit comments