Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UBERF-6639: Fix default status when switching task types #5685

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/task/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down