From 0f740689e17e4845d1aa26f3b0af034e5e362e1b Mon Sep 17 00:00:00 2001 From: Alexey Zinoviev Date: Tue, 28 May 2024 18:25:28 +0400 Subject: [PATCH] uberf-6639: fix create issue default status Signed-off-by: Alexey Zinoviev --- plugins/task/src/utils.ts | 2 +- .../src/components/issues/StatusEditor.svelte | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/task/src/utils.ts b/plugins/task/src/utils.ts index 67e881c9f82..69f43946385 100644 --- a/plugins/task/src/utils.ts +++ b/plugins/task/src/utils.ts @@ -114,7 +114,7 @@ export async function createState ( if (exists !== undefined) { return exists._id as Ref } - const res = await client.createDoc(_class, task.space.Statuses, data) + const res = await client.createDoc(_class, core.space.Model, data) return res } diff --git a/plugins/tracker-resources/src/components/issues/StatusEditor.svelte b/plugins/tracker-resources/src/components/issues/StatusEditor.svelte index 4f5b151870a..d3ae09c78de 100644 --- a/plugins/tracker-resources/src/components/issues/StatusEditor.svelte +++ b/plugins/tracker-resources/src/components/issues/StatusEditor.svelte @@ -96,15 +96,18 @@ return current } } + if (defaultIssueStatus !== undefined) { const res = statuses?.find((status) => status._id === defaultStatus) - void changeStatus(res?._id, false) - return res + // Might not exist for projects with multiple task types with different statuses + if (res != null) { + void changeStatus(res?._id, false) + return res + } } + // We need to choose first one, since it should not be case without status. - if (value.status === undefined) { - void changeStatus(statuses?.[0]?._id, false) - } + void changeStatus(statuses?.[0]?._id, false) } $: selectedStatus = getSelectedStatus(statuses, value, defaultIssueStatus)