|
4 | 4 | GitSelfManagedHostIntegrationId,
|
5 | 5 | IssuesCloudHostIntegrationId,
|
6 | 6 | } from '../../../../constants.integrations';
|
7 |
| -import type { GitRemote } from '../../../../git/models/remote'; |
8 |
| -import type { RemoteProviderId } from '../../../../git/remotes/remoteProvider'; |
| 7 | +import type { RemoteProvider, RemoteProviderId } from '../../../../git/remotes/remoteProvider'; |
9 | 8 | import type { IntegrationConnectedKey } from '../../models/integration';
|
10 | 9 | import { isAzureCloudDomain } from '../../providers/azureDevOps';
|
11 | 10 | import { isBitbucketCloudDomain } from '../../providers/bitbucket';
|
@@ -64,30 +63,30 @@ export function getIntegrationConnectedKey<T extends IntegrationIds>(
|
64 | 63 | }
|
65 | 64 |
|
66 | 65 | export function getIntegrationIdForRemote(
|
67 |
| - remote: GitRemote, |
| 66 | + provider: RemoteProvider | undefined, |
68 | 67 | ): GitCloudHostIntegrationId | GitSelfManagedHostIntegrationId | undefined {
|
69 |
| - switch (remote.provider?.id) { |
| 68 | + switch (provider?.id) { |
70 | 69 | case 'azure-devops':
|
71 |
| - if (isAzureCloudDomain(remote.provider.domain)) { |
| 70 | + if (isAzureCloudDomain(provider.domain)) { |
72 | 71 | return GitCloudHostIntegrationId.AzureDevOps;
|
73 | 72 | }
|
74 |
| - return remote.provider.custom ? undefined : GitSelfManagedHostIntegrationId.AzureDevOpsServer; |
| 73 | + return provider.custom ? undefined : GitSelfManagedHostIntegrationId.AzureDevOpsServer; |
75 | 74 | case 'bitbucket':
|
76 | 75 | case 'bitbucket-server':
|
77 |
| - if (isBitbucketCloudDomain(remote.provider.domain)) { |
| 76 | + if (isBitbucketCloudDomain(provider.domain)) { |
78 | 77 | return GitCloudHostIntegrationId.Bitbucket;
|
79 | 78 | }
|
80 | 79 | return GitSelfManagedHostIntegrationId.BitbucketServer;
|
81 | 80 | case 'github':
|
82 |
| - if (remote.provider.domain != null && !isGitHubDotCom(remote.provider.domain)) { |
83 |
| - return remote.provider.custom |
| 81 | + if (provider.domain != null && !isGitHubDotCom(provider.domain)) { |
| 82 | + return provider.custom |
84 | 83 | ? GitSelfManagedHostIntegrationId.GitHubEnterprise
|
85 | 84 | : GitSelfManagedHostIntegrationId.CloudGitHubEnterprise;
|
86 | 85 | }
|
87 | 86 | return GitCloudHostIntegrationId.GitHub;
|
88 | 87 | case 'gitlab':
|
89 |
| - if (remote.provider.domain != null && !isGitLabDotCom(remote.provider.domain)) { |
90 |
| - return remote.provider.custom |
| 88 | + if (provider.domain != null && !isGitLabDotCom(provider.domain)) { |
| 89 | + return provider.custom |
91 | 90 | ? GitSelfManagedHostIntegrationId.GitLabSelfHosted
|
92 | 91 | : GitSelfManagedHostIntegrationId.CloudGitLabSelfHosted;
|
93 | 92 | }
|
|
0 commit comments