@@ -8,8 +8,8 @@ import { COPILOT_ACCOUNTS, IComment } from '../common/comment';
8
8
import { Disposable } from '../common/lifecycle' ;
9
9
import Logger from '../common/logger' ;
10
10
import { Remote } from '../common/remote' ;
11
- import { ClosedEvent , EventType , TimelineEvent } from '../common/timelineEvent' ;
12
- import { formatError } from '../common/utils' ;
11
+ import { ClosedEvent , CrossReferencedEvent , EventType , TimelineEvent } from '../common/timelineEvent' ;
12
+ import { compareIgnoreCase , formatError } from '../common/utils' ;
13
13
import { OctokitCommon } from './common' ;
14
14
import { CopilotWorkingStatus , GitHubRepository } from './githubRepository' ;
15
15
import {
@@ -470,8 +470,23 @@ export class IssueModel<TItem extends Issue = Issue> extends Disposable {
470
470
Logger . error ( 'Unexpected null repository when getting issue timeline events' , GitHubRepository . ID ) ;
471
471
return [ ] ;
472
472
}
473
+
473
474
const ret = data . repository . pullRequest . timelineItems . nodes ;
474
475
const events = await parseCombinedTimelineEvents ( ret , await this . getCopilotTimelineEvents ( issueModel , true ) , this . githubRepository ) ;
476
+
477
+ const crossRefs = events . filter ( ( event ) : event is CrossReferencedEvent => {
478
+ if ( ( event . event === EventType . CrossReferenced ) && ! event . source . isIssue ) {
479
+ return ! this . githubRepository . getExistingPullRequestModel ( event . source . number ) && ( compareIgnoreCase ( event . source . owner , issueModel . remote . owner ) === 0 && compareIgnoreCase ( event . source . repo , issueModel . remote . repositoryName ) === 0 ) ;
480
+ }
481
+ return false ;
482
+
483
+ } ) ;
484
+
485
+ for ( const unseenPrs of crossRefs ) {
486
+ // Kick off getting the new PRs so that the system knows about them (and refreshes the tree when they're found)
487
+ this . githubRepository . getPullRequest ( unseenPrs . source . number ) ;
488
+ }
489
+
475
490
issueModel . timelineEvents = events ;
476
491
return events ;
477
492
} catch ( e ) {
0 commit comments