fix(quick actions): use default project when creating a new task via quick add magic without specifying a project

Resolves https://community.vikunja.io/t/keyboard-navigation/3098/2
This commit is contained in:
kolaente 2025-01-21 14:49:34 +01:00
parent ccd79a7089
commit dc3930cfa7
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B
2 changed files with 7 additions and 3 deletions

View File

@ -502,12 +502,13 @@ async function doCmd() {
}
async function newTask() {
if (currentProject.value === null) {
return
let projectId = authStore.settings.defaultProjectId
if (currentProject.value.id) {
projectId = currentProject.value.id
}
const task = await taskStore.createNewTask({
title: query.value,
projectId: currentProject.value.id,
projectId,
})
success({message: t('task.createSuccess')})
await router.push({name: 'task.detail', params: {id: task.id}})

View File

@ -390,6 +390,9 @@ export const useTaskStore = defineStore('task', () => {
}
foundProjectId = project === null ? null : project.id
if (foundProjectId !== null) {
return foundProjectId
}
}
// 2. Else check if a project was passed as parameter