@@ -8,7 +8,7 @@ import type { Issue, IssueShape } from '../../../git/models/issue';
88import type { IssueOrPullRequest , IssueOrPullRequestType } from '../../../git/models/issueOrPullRequest' ;
99import type { PullRequest , PullRequestMergeMethod , PullRequestState } from '../../../git/models/pullRequest' ;
1010import type { RepositoryMetadata } from '../../../git/models/repositoryMetadata' ;
11- import { getSettledValue } from '../../../system/promise' ;
11+ import { flatSettled } from '../../../system/promise' ;
1212import { base64 } from '../../../system/string' ;
1313import type { IntegrationAuthenticationProviderDescriptor } from '../authentication/integrationAuthenticationProvider' ;
1414import type { IntegrationAuthenticationService } from '../authentication/integrationAuthenticationService' ;
@@ -119,16 +119,13 @@ export abstract class AzureDevOpsIntegrationBase<
119119
120120 if ( resourcesWithoutProjects . length > 0 ) {
121121 const api = await this . getProvidersApi ( ) ;
122- const azureProjects = (
123- await Promise . allSettled (
124- resourcesWithoutProjects . map ( resource =>
125- api . getAzureProjectsForResource ( resource . name , this . id , this . getApiOptions ( accessToken ) ) ,
126- ) ,
127- )
128- )
129- . map ( r => getSettledValue ( r ) ?. values )
130- . flat ( )
131- . filter ( p => p != null ) ;
122+ const azureProjects = await flatSettled (
123+ resourcesWithoutProjects . map (
124+ async resource =>
125+ ( await api . getAzureProjectsForResource ( resource . name , this . id , this . getApiOptions ( accessToken ) ) )
126+ . values ,
127+ ) ,
128+ ) ;
132129
133130 for ( const resource of resourcesWithoutProjects ) {
134131 const projects = azureProjects ?. filter ( p => p . namespace === resource . name ) ;
@@ -412,32 +409,28 @@ export abstract class AzureDevOpsIntegrationBase<
412409 const projects = await this . getProviderProjectsForResources ( session , orgs ) ;
413410 if ( projects == null || projects . length === 0 ) return undefined ;
414411
415- const assignedIssues = (
416- await Promise . all (
417- projects . map ( async p => {
418- const issuesResponse = (
419- await api . getIssuesForAzureProject ( this . id , p . resourceName , p . name , {
420- ...this . getApiOptions ( session . accessToken ) ,
421- assigneeLogins : [ user . username ! ] ,
422- } )
423- ) . values ;
424- return issuesResponse . map ( i => fromProviderIssue ( i , this as any , { project : p } ) ) ;
425- } ) ,
426- )
427- ) . flat ( ) ;
428- const authoredIssues = (
429- await Promise . all (
430- projects . map ( async p => {
431- const issuesResponse = (
432- await api . getIssuesForAzureProject ( this . id , p . resourceName , p . name , {
433- ...this . getApiOptions ( session . accessToken ) ,
434- authorLogin : user . username ! ,
435- } )
436- ) . values ;
437- return issuesResponse . map ( i => fromProviderIssue ( i , this as any , { project : p } ) ) ;
438- } ) ,
439- )
440- ) . flat ( ) ;
412+ const assignedIssues = await flatSettled (
413+ projects . map ( async p => {
414+ const issuesResponse = (
415+ await api . getIssuesForAzureProject ( this . id , p . resourceName , p . name , {
416+ ...this . getApiOptions ( session . accessToken ) ,
417+ assigneeLogins : [ user . username ! ] ,
418+ } )
419+ ) . values ;
420+ return issuesResponse . map ( i => fromProviderIssue ( i , this as any , { project : p } ) ) ;
421+ } ) ,
422+ ) ;
423+ const authoredIssues = await flatSettled (
424+ projects . map ( async p => {
425+ const issuesResponse = (
426+ await api . getIssuesForAzureProject ( this . id , p . resourceName , p . name , {
427+ ...this . getApiOptions ( session . accessToken ) ,
428+ authorLogin : user . username ! ,
429+ } )
430+ ) . values ;
431+ return issuesResponse . map ( i => fromProviderIssue ( i , this as any , { project : p } ) ) ;
432+ } ) ,
433+ ) ;
441434 // TODO: Add mentioned issues
442435 const issuesById = new Map < string , IssueShape > ( ) ;
443436
0 commit comments