fix(quick actions): do not allow creating a task when the current project is a saved filter
continuous-integration/drone/push Build is passing Details

Resolves https://community.vikunja.io/t/creating-task-on-saved-filter-page-doesnt-save/2127
This commit is contained in:
kolaente 2024-03-13 18:16:18 +01:00
parent b3caece256
commit 1de39b1cd1
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 11 additions and 7 deletions

View File

@ -85,7 +85,7 @@
</template>
<script setup lang="ts">
import {ref, computed, watchEffect, shallowReactive, type ComponentPublicInstance} from 'vue'
import {type ComponentPublicInstance, computed, ref, shallowReactive, watchEffect} from 'vue'
import {useI18n} from 'vue-i18n'
import {useRouter} from 'vue-router'
@ -107,13 +107,14 @@ import {useTaskStore} from '@/stores/tasks'
import {useAuthStore} from '@/stores/auth'
import {getHistory} from '@/modules/projectHistory'
import {parseTaskText, PrefixMode, PREFIXES} from '@/modules/parseTaskText'
import {parseTaskText, PREFIXES, PrefixMode} from '@/modules/parseTaskText'
import {success} from '@/message'
import type {ITeam} from '@/modelTypes/ITeam'
import type {ITask} from '@/modelTypes/ITask'
import type {IProject} from '@/modelTypes/IProject'
import type {IAbstract} from '@/modelTypes/IAbstract'
import {isSavedFilter} from '@/services/savedFilter'
const {t} = useI18n({useScope: 'global'})
const router = useRouter()
@ -280,10 +281,13 @@ const commands = computed<{ [key in COMMAND_TYPE]: Command }>(() => ({
const placeholder = computed(() => selectedCmd.value?.placeholder || t('quickActions.placeholder'))
const currentProject = computed(() => Object.keys(baseStore.currentProject).length === 0
? null
: baseStore.currentProject,
)
const currentProject = computed(() => {
if (Object.keys(baseStore.currentProject).length === 0 || isSavedFilter(baseStore.currentProject)) {
return null
}
return baseStore.currentProject
})
const hintText = computed(() => {
if (selectedCmd.value !== null && currentProject.value !== null) {
@ -372,7 +376,7 @@ function searchTasks() {
const {text, project: projectName, labels} = parsedQuery.value
let filter = ''
if (projectName !== null) {
const project = projectStore.findProjectByExactname(projectName)
console.log({project})