Skip to content

Commit dd33503

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

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
@@ -409,7 +409,13 @@ abstract class GitLabIntegrationBase<
409409
}
410410

411411
protected override getProviderPullRequestIdentityFromMaybeUrl(search: string): PullRequestUrlIdentity | undefined {
412-
return getGitLabPullRequestIdentityFromMaybeUrl(search);
412+
const identity = getGitLabPullRequestIdentityFromMaybeUrl(search);
413+
if (identity == null) return undefined;
414+
415+
return {
416+
...identity,
417+
provider: this.id,
418+
};
413419
}
414420
}
415421

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

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

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)