Exclude default shared workspaces from tab
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
b69f0b7dc4
commit
0ff778ec29
2 changed files with 42 additions and 0 deletions
|
|
@ -195,4 +195,31 @@ describe("buildProjectWorkspaceSummaries", () => {
|
|||
expect(summaries).toHaveLength(1);
|
||||
expect(summaries[0]?.key).toBe("execution:exec-2");
|
||||
});
|
||||
|
||||
it("excludes issues that only use the default shared workspace", () => {
|
||||
const summaries = buildProjectWorkspaceSummaries({
|
||||
project,
|
||||
issues: [
|
||||
createIssue({
|
||||
id: "issue-default-shared",
|
||||
projectWorkspaceId: primaryWorkspace.id,
|
||||
executionWorkspaceId: "exec-shared-default",
|
||||
updatedAt: new Date("2026-03-26T12:00:00Z"),
|
||||
}),
|
||||
],
|
||||
executionWorkspaces: [
|
||||
createExecutionWorkspace({
|
||||
id: "exec-shared-default",
|
||||
mode: "shared_workspace",
|
||||
strategyType: "project_primary",
|
||||
projectWorkspaceId: primaryWorkspace.id,
|
||||
branchName: null,
|
||||
baseRef: null,
|
||||
providerType: "local_fs",
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
expect(summaries).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -36,6 +36,16 @@ function primaryWorkspaceId(project: ProjectWorkspaceLike): string | null {
|
|||
?? null;
|
||||
}
|
||||
|
||||
function isDefaultSharedExecutionWorkspace(input: {
|
||||
executionWorkspace: ExecutionWorkspace;
|
||||
issue: Issue;
|
||||
primaryWorkspaceId: string | null;
|
||||
}) {
|
||||
const linkedProjectWorkspaceId =
|
||||
input.executionWorkspace.projectWorkspaceId ?? input.issue.projectWorkspaceId ?? null;
|
||||
return input.executionWorkspace.mode === "shared_workspace" && linkedProjectWorkspaceId === input.primaryWorkspaceId;
|
||||
}
|
||||
|
||||
export function buildProjectWorkspaceSummaries(input: {
|
||||
project: ProjectWorkspaceLike;
|
||||
issues: Issue[];
|
||||
|
|
@ -54,6 +64,11 @@ export function buildProjectWorkspaceSummaries(input: {
|
|||
if (issue.executionWorkspaceId) {
|
||||
const executionWorkspace = executionWorkspacesById.get(issue.executionWorkspaceId);
|
||||
if (!executionWorkspace) continue;
|
||||
if (isDefaultSharedExecutionWorkspace({
|
||||
executionWorkspace,
|
||||
issue,
|
||||
primaryWorkspaceId: primaryId,
|
||||
})) continue;
|
||||
|
||||
const existing = summaries.get(`execution:${executionWorkspace.id}`);
|
||||
const nextIssues = [...(existing?.issues ?? []), issue].sort(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue