From 6f9b0ddfe7aa8a77b7d758742a41bb512a2f2797 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 11 Dec 2024 18:28:29 +0100 Subject: [PATCH] fix(tasks): do not show import hint when using a filter as home tasks and already imported This fixes a bug where the "import your tasks from other platforms" would be shown even if the user had already imported tasks. The bug was caused by the heuristic "there are tasks" was not evaluated when tasks were loaded through a filter Resolves https://github.com/go-vikunja/vikunja/issues/372 --- frontend/src/stores/tasks.ts | 15 ++++++++------- frontend/src/views/Home.vue | 5 ++++- frontend/src/views/tasks/ShowTasks.vue | 15 ++++++++++----- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/frontend/src/stores/tasks.ts b/frontend/src/stores/tasks.ts index ab124c8b2..d00674446 100644 --- a/frontend/src/stores/tasks.ts +++ b/frontend/src/stores/tasks.ts @@ -28,7 +28,7 @@ import {useKanbanStore} from '@/stores/kanban' import {useBaseStore} from '@/stores/base' import ProjectUserService from '@/services/projectUsers' import {useAuthStore} from '@/stores/auth' -import {type TaskFilterParams} from '@/services/taskCollection' +import TaskCollectionService, {type TaskFilterParams} from '@/services/taskCollection' import {getRandomColorHex} from '@/helpers/color/randomColor' import {REPEAT_TYPES} from '@/types/IRepeatAfter' import {TASK_REPEAT_MODES} from '@/types/IRepeatMode' @@ -134,15 +134,16 @@ export const useTaskStore = defineStore('task', () => { if (!params.filter_timezone || params.filter_timezone === '') { params.filter_timezone = authStore.settings.timezone } - - if (projectId !== null) { - params.filter = 'project = '+projectId+' && (' + params.filter +')' - } const cancel = setModuleLoading(setIsLoading) try { - const taskService = new TaskService() - tasks.value = await taskService.getAll({}, params) + const model = {} + let taskCollectionService = new TaskService() + if (projectId !== null) { + model.projectId = projectId + taskCollectionService = new TaskCollectionService() + } + tasks.value = await taskCollectionService.getAll(model, params) baseStore.setHasTasks(tasks.value.length > 0) return tasks.value } finally { diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vue index cf229ca2c..87fc26c82 100644 --- a/frontend/src/views/Home.vue +++ b/frontend/src/views/Home.vue @@ -23,7 +23,7 @@ class="is-max-width-desktop" @taskAdded="updateTaskKey" /> -