From dc3930cfa793207321a0573e82796752c290fb91 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 21 Jan 2025 14:49:34 +0100 Subject: [PATCH] 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 --- frontend/src/components/quick-actions/QuickActions.vue | 7 ++++--- frontend/src/stores/tasks.ts | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/quick-actions/QuickActions.vue b/frontend/src/components/quick-actions/QuickActions.vue index 88de92903..bf9aea1fb 100644 --- a/frontend/src/components/quick-actions/QuickActions.vue +++ b/frontend/src/components/quick-actions/QuickActions.vue @@ -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}}) diff --git a/frontend/src/stores/tasks.ts b/frontend/src/stores/tasks.ts index d00674446..9eff65ab4 100644 --- a/frontend/src/stores/tasks.ts +++ b/frontend/src/stores/tasks.ts @@ -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