Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(issues): inherit parent's project and assignee when creating a sub-issue (#6727)
Danila Katalshov822c6a0b8c08
diff --git a/packages/views/issues/actions/__tests__/use-issue-actions.test.tsx b/packages/views/issues/actions/__tests__/use-issue-actions.test.tsxindex ed029f7815..e9e3ec236e 100644--- a/packages/views/issues/actions/__tests__/use-issue-actions.test.tsx+++ b/packages/views/issues/actions/__tests__/use-issue-actions.test.tsx@@ -250,6 +250,48 @@ describe("useIssueActions", () => {});});+ it("openCreateSubIssue seeds the parent's project and assignee so the sub-issue inherits them", () => {+ const parentIssue = {+ ...mockIssue,+ project_id: "project-1",+ assignee_type: "agent",+ assignee_id: "agent-1",+ } as Issue;+ const { result } = renderHook(() => useIssueActions(parentIssue), { wrapper });++ act(() => {+ result.current.openCreateSubIssue();+ });++ expect(mockOpenModal).toHaveBeenLastCalledWith("create-issue", {+ parent_issue_id: "issue-1",+ parent_issue_identifier: "TES-1",+ project_id: "project-1",+ assignee_type: "agent",+ assignee_id: "agent-1",+ });+ });++ it("openCreateSubIssue omits assignee when the parent has none", () => {+ const parentIssue = {+ ...mockIssue,+ project_id: "project-1",+ assignee_type: null,+ assignee_id: null,+ } as Issue;+ const { result } = renderHook(() => useIssueActions(parentIssue), { wrapper });++ act(() => {+ result.current.openCreateSubIssue();+ });++ expect(mockOpenModal).toHaveBeenLastCalledWith("create-issue", {+ parent_issue_id: "issue-1",+ parent_issue_identifier: "TES-1",+ project_id: "project-1",+ });+ });+it("removeParent clears parent_issue_id and stage in one write, never via the run-confirm modal", () => {const childIssue = {...mockIssue,diff --git a/packages/views/issues/actions/use-issue-actions.ts b/packages/views/issues/actions/use-issue-actions.tsindex de53cf72ad..9aaa92a63f 100644--- a/packages/views/issues/actions/use-issue-actions.ts+++ b/packages/views/issues/actions/use-issue-actions.ts@@ -61,6 +61,8 @@ export function useIssueActions(issue: Issue | null): UseIssueActionsResult {const issueId = issue?.id ?? null;const issueIdentifier = issue?.identifier ?? null;const issueProjectId = issue?.project_id ?? null;+ const issueAssigneeType = issue?.assignee_type ?? null;+ const issueAssigneeId = issue?.assignee_id ?? null;const issueStatus = issue?.status ?? null;const updateField = useCallback(@@ -165,8 +167,25 @@ export function useIssueActions(issue: Issue | null): UseIssueActionsResult {parent_issue_id: issueId,parent_issue_identifier: issueIdentifier,...(issueProjectId ? { project_id: issueProjectId } : {}),+ // Inherit the parent's assignee (member/agent/squad) so a sub-issue+ // created from the "Add sub-issue" entry starts with the same owner+ // (discussion #1728). The modal keys off whether these fields are+ // present, not their value, so a seed overrides the sticky last-used+ // assignee it would otherwise fall back to, while omitting both for+ // an unassigned parent leaves that fallback intact. Seed the two+ // together — assignee_type is meaningless without assignee_id.+ ...(issueAssigneeType && issueAssigneeId+ ? { assignee_type: issueAssigneeType, assignee_id: issueAssigneeId }+ : {}),});- }, [openModal, issueId, issueIdentifier, issueProjectId]);+ }, [+ openModal,+ issueId,+ issueIdentifier,+ issueProjectId,+ issueAssigneeType,+ issueAssigneeId,+ ]);const openSetParent = useCallback(() => {if (!issueId) return;