uberf-6639: fix create issue default status (#5685)

Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
Alexey Zinoviev 2024-05-28 18:51:53 +04:00 committed by GitHub
parent 2d163bf428
commit 619939b2a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View File

@ -114,7 +114,7 @@ export async function createState<T extends Status> (
if (exists !== undefined) {
return exists._id as Ref<T>
}
const res = await client.createDoc(_class, task.space.Statuses, data)
const res = await client.createDoc(_class, core.space.Model, data)
return res
}

View File

@ -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)