From 9903b63dedbad0c82bed2a0908378e44580f2f67 Mon Sep 17 00:00:00 2001 From: Sergei Shmakov Date: Mon, 23 Dec 2024 16:56:41 +0100 Subject: [PATCH] Reuses connected integrations by passing to getPullRequestIdentity... (#3788, #3795) --- src/plus/launchpad/launchpadProvider.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plus/launchpad/launchpadProvider.ts b/src/plus/launchpad/launchpadProvider.ts index 875a92b121651..a98854b9face0 100644 --- a/src/plus/launchpad/launchpadProvider.ts +++ b/src/plus/launchpad/launchpadProvider.ts @@ -214,14 +214,16 @@ export class LaunchpadProvider implements Disposable { } private async getSearchedPullRequests(search: string, cancellation?: CancellationToken) { - const prUrlIdentity: PullRequestUrlIdentity | undefined = await this.getPullRequestIdentityFromMaybeUrl(search); + const connectedIntegrations = await this.getConnectedIntegrations(); + const prUrlIdentity: PullRequestUrlIdentity | undefined = await this.getPullRequestIdentityFromMaybeUrl( + search, + connectedIntegrations, + ); const result: { readonly value: SearchedPullRequest[]; duration: number } = { value: [], duration: 0, }; - const connectedIntegrations = await this.getConnectedIntegrations(); - const findByPrIdentity = async ( integration: HostingIntegration, ): Promise> => { @@ -589,8 +591,10 @@ export class LaunchpadProvider implements Disposable { ); } - async getPullRequestIdentityFromMaybeUrl(search: string): Promise { - const connectedIntegrations = await this.getConnectedIntegrations(); + async getPullRequestIdentityFromMaybeUrl( + search: string, + connectedIntegrations: Map, + ): Promise { for (const integrationId of supportedLaunchpadIntegrations) { if (connectedIntegrations.get(integrationId)) { const integration = await this.container.integrations.get(integrationId);