Skip to content

Commit

Permalink
Reuses connected integrations by passing to getPullRequestIdentity...
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeibbb committed Dec 26, 2024
1 parent 44996dc commit 7410224
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/plus/launchpad/launchpadProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<undefined | TimedResult<SearchedPullRequest[] | undefined>> => {
Expand Down Expand Up @@ -589,8 +591,10 @@ export class LaunchpadProvider implements Disposable {
);
}

async getPullRequestIdentityFromMaybeUrl(search: string): Promise<PullRequestUrlIdentity | undefined> {
const connectedIntegrations = await this.getConnectedIntegrations();
async getPullRequestIdentityFromMaybeUrl(
search: string,
connectedIntegrations: Map<IntegrationId, boolean>,
): Promise<PullRequestUrlIdentity | undefined> {
for (const integrationId of supportedLaunchpadIntegrations) {
if (connectedIntegrations.get(integrationId)) {
const integration = await this.container.integrations.get(integrationId);
Expand Down

0 comments on commit 7410224

Please sign in to comment.