Skip to content

Commit 0d463ae

Browse files
committed
Adds search by URL for GitLab Self Managed to the Launchpad
(#3934)
1 parent 7134b9c commit 0d463ae

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
@@ -437,7 +437,13 @@ abstract class GitLabIntegrationBase<
437437
}
438438

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

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/models/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)