Skip to content

Commit a49f489

Browse files
committed
Adds search by URL for GitLab Self Managed to the Launchpad
(#3942)
1 parent ea81553 commit a49f489

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/plus/integrations/providers/gitlab.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,13 @@ abstract class GitLabIntegrationBase<
438438
}
439439

440440
protected override getProviderPullRequestIdentityFromMaybeUrl(search: string): PullRequestUrlIdentity | undefined {
441-
return getGitLabPullRequestIdentityFromMaybeUrl(search);
441+
const identity = getGitLabPullRequestIdentityFromMaybeUrl(search);
442+
if (identity == null) return undefined;
443+
444+
return {
445+
...identity,
446+
provider: this.id,
447+
};
442448
}
443449
}
444450

src/plus/integrations/providers/gitlab/__tests__/gitlab.utils.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ suite('Test GitLab PR URL parsing to identity: getPullRequestIdentityFromMaybeUr
1111
: {
1212
ownerAndRepo: ownerAndRepo,
1313
prNumber: prNumber,
14-
provider: 'gitlab',
1514
},
1615
`Parse: ${message} (${JSON.stringify(query)})`,
1716
);

src/plus/integrations/providers/gitlab/gitlab.utils.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// That's why this file has been created that can collect more simple functions which
33
// don't require Container and can be tested.
44

5-
import { HostingIntegrationId } from '../../../../constants.integrations';
65
import type { PullRequestUrlIdentity } from '../../../../git/utils/pullRequest.utils';
76

87
export function isMaybeGitLabPullRequestUrl(url: string): boolean {
@@ -11,7 +10,7 @@ export function isMaybeGitLabPullRequestUrl(url: string): boolean {
1110

1211
export function getGitLabPullRequestIdentityFromMaybeUrl(
1312
search: string,
14-
): (PullRequestUrlIdentity & { provider: HostingIntegrationId.GitLab }) | undefined {
13+
): Omit<PullRequestUrlIdentity, 'provider'> | undefined {
1514
let ownerAndRepo: string | undefined = undefined;
1615
let prNumber: string | undefined = undefined;
1716

@@ -28,7 +27,5 @@ export function getGitLabPullRequestIdentityFromMaybeUrl(
2827
}
2928
}
3029

31-
return prNumber != null
32-
? { ownerAndRepo: ownerAndRepo, prNumber: prNumber, provider: HostingIntegrationId.GitLab }
33-
: undefined;
30+
return prNumber != null ? { ownerAndRepo: ownerAndRepo, prNumber: prNumber } : undefined;
3431
}

0 commit comments

Comments
 (0)