Skip to content

Commit 045e909

Browse files
committed
wip: provides retrieved PRs to the Launchpad view #4046
1 parent e98fa74 commit 045e909

File tree

3 files changed

+28
-20
lines changed

3 files changed

+28
-20
lines changed

src/plus/drafts/draftsService.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,9 @@ export class DraftService implements Disposable {
862862
.map(pr => {
863863
return EntityIdentifierUtils.encode(getEntityIdentifierInput(pr));
864864
});
865+
if (prEntityIds.length === 0) {
866+
return {};
867+
}
865868

866869
const body = JSON.stringify({
867870
prEntityIds: prEntityIds,

src/plus/integrations/providers/bitbucket.ts

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface BitbucketWorkspaceDescriptor extends ResourceDescriptor {
3535

3636
interface BitbucketRemoteRepositoryDescriptor extends ResourceDescriptor {
3737
id: string;
38-
// nodeId?: string;
38+
nodeId?: string;
3939
resourceName: string;
4040
owner: string;
4141
name: string;
@@ -330,10 +330,10 @@ export class BitbucketIntegration extends HostingIntegration<
330330
repoDescriptors: BitbucketRemoteRepositoryDescriptor[],
331331
): PullRequest {
332332
const baseRepoDescriptor = repoDescriptors.find(r => r.name === remotePullRequest.repository.name);
333-
const headRepoDescriptor =
334-
remotePullRequest.headRepository != null
335-
? repoDescriptors.find(r => r.name === remotePullRequest.headRepository!.name)
336-
: undefined;
333+
// const headRepoDescriptor =
334+
// remotePullRequest.headRepository != null
335+
// ? repoDescriptors.find(r => r.name === remotePullRequest.headRepository!.name)
336+
// : undefined;
337337
if (baseRepoDescriptor != null) {
338338
remotePullRequest.repository.remoteInfo = {
339339
...remotePullRequest.repository.remoteInfo,
@@ -342,21 +342,22 @@ export class BitbucketIntegration extends HostingIntegration<
342342
};
343343
}
344344

345-
if (headRepoDescriptor != null) {
346-
remotePullRequest.headRepository = {
347-
...remotePullRequest.headRepository,
348-
id: remotePullRequest.headRepository?.id ?? headRepoDescriptor.id,
349-
name: remotePullRequest.headRepository?.name ?? headRepoDescriptor.name,
350-
owner: {
351-
login: remotePullRequest.headRepository?.owner.login ?? headRepoDescriptor.resourceName,
352-
},
353-
remoteInfo: {
354-
...remotePullRequest.headRepository?.remoteInfo,
355-
cloneUrlHTTPS: headRepoDescriptor.cloneUrlHttps ?? '',
356-
cloneUrlSSH: headRepoDescriptor.cloneUrlSsh ?? '',
357-
},
358-
};
359-
}
345+
// if (headRepoDescriptor != null) {
346+
// remotePullRequest.headRepository = {
347+
// ...remotePullRequest.headRepository,
348+
// id: remotePullRequest.headRepository?.id ?? headRepoDescriptor.id,
349+
// name: remotePullRequest.headRepository?.name ?? headRepoDescriptor.name,
350+
// owner: {
351+
// login: remotePullRequest.headRepository?.owner.login ?? headRepoDescriptor.resourceName,
352+
// },
353+
// remoteInfo: {
354+
// ...remotePullRequest.headRepository?.remoteInfo,
355+
// cloneUrlHTTPS: headRepoDescriptor.cloneUrlHttps ?? '',
356+
// cloneUrlSSH: headRepoDescriptor.cloneUrlSsh ?? '',
357+
// },
358+
// };
359+
// }
360+
remotePullRequest.graphQLId = remotePullRequest.id;
360361
return fromProviderPullRequest(remotePullRequest, this);
361362
}
362363
}

src/plus/integrations/providers/utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ export function getEntityIdentifierInput(entity: Issue | PullRequest | Launchpad
6262
if (entityType === EntityType.PullRequest && repoId == null) {
6363
throw new Error('Azure PRs must have a repository ID to be encoded');
6464
}
65+
} else if (provider === EntityIdentifierProviderType.Bitbucket) {
66+
repoId = isLaunchpadItem(entity) ? entity.underlyingPullRequest?.repository.id : entity.repository?.id;
67+
// projectId = entity.repository.id;
68+
// resourceId = entity.repository.resourceId;
6569
}
6670

6771
let entityId = isLaunchpadItem(entity) ? entity.graphQLId! : entity.nodeId!;

0 commit comments

Comments
 (0)