Skip to content

Commit

Permalink
Makes UI to request Auzure autolinks properly
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeibbb committed Jan 29, 2025
1 parent bf589c2 commit e49fab8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/autolinks/autolinks.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { ConfigurationChangeEvent } from 'vscode';
import { Disposable } from 'vscode';
import { GlyphChars } from '../constants';
import type { IntegrationId } from '../constants.integrations';
import { IssueIntegrationId } from '../constants.integrations';
import type { Container } from '../container';
import type { GitRemote } from '../git/models/remote';
import { getIssueOrPullRequestHtmlIcon, getIssueOrPullRequestMarkdownIcon } from '../git/utils/-webview/icons';
import type { HostingIntegration, IssueIntegration } from '../plus/integrations/integration';
import { remoteProviderIdToIntegrationId } from '../plus/integrations/integrationService';
import { configuration } from '../system/-webview/configuration';
import { fromNow } from '../system/date';
import { debug } from '../system/decorators/log';
Expand Down Expand Up @@ -214,9 +214,9 @@ export class Autolinks implements Disposable {

const enrichedAutolinks = new Map<string, EnrichedAutolink>();
for (const [id, link] of messageOrAutolinks) {
let linkIntegration = link.provider
? await this.container.integrations.get(link.provider.id as IntegrationId)
: undefined;
const integrationId = link.provider ? remoteProviderIdToIntegrationId(link.provider.id) : undefined;
let linkIntegration =
integrationId != null ? await this.container.integrations.get(integrationId) : undefined;
if (linkIntegration != null) {
const connected = linkIntegration.maybeConnected ?? (await linkIntegration.isConnected());
if (!connected || !(await linkIntegration.access())) {
Expand All @@ -226,7 +226,7 @@ export class Autolinks implements Disposable {
const issueOrPullRequestPromise =
remote?.provider != null &&
integration != null &&
link.provider?.id === integration.id &&
integrationId === integration.id &&
link.provider?.domain === integration.domain
? integration.getIssueOrPullRequest(
link.descriptor ?? remote.provider.repoDesc,
Expand Down
7 changes: 1 addition & 6 deletions src/plus/integrations/integrationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1029,13 +1029,8 @@ export class IntegrationService implements Disposable {
}
}

export function remoteProviderIdToIntegrationId(
remoteProviderId: RemoteProviderId,
): SupportedCloudIntegrationIds | undefined {
export function remoteProviderIdToIntegrationId(remoteProviderId: unknown): SupportedCloudIntegrationIds | undefined {
switch (remoteProviderId) {
// TODO: Uncomment when we support these integrations
// case 'bitbucket':
// return HostingIntegrationId.Bitbucket;
case 'azure-devops':
return HostingIntegrationId.AzureDevOps;
case 'github':
Expand Down

0 comments on commit e49fab8

Please sign in to comment.