fix(task): do not allow moving a task to the project the task already belongs to

This commit is contained in:
kolaente 2024-08-12 15:18:00 +02:00
parent 670e605275
commit 7efc4d1bc8
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 8 additions and 3 deletions

View File

@ -73,7 +73,7 @@
>
<template v-if="canWrite">
<span class="icon handle">
<Icon icon="grip-lines"/>
<Icon icon="grip-lines" />
</span>
</template>
</SingleTaskInProject>

View File

@ -36,9 +36,11 @@ import Multiselect from '@/components/input/Multiselect.vue'
const props = withDefaults(defineProps<{
modelValue?: IProject
savedFiltersOnly?: boolean
filter?: (project: IProject) => boolean,
}>(), {
modelValue: () => new ProjectModel(),
savedFiltersOnly: false,
filter: () => true,
})
const emit = defineEmits<{
@ -65,11 +67,13 @@ function findProjects(query: string) {
}
if (props.savedFiltersOnly) {
foundProjects.value = projectStore.searchSavedFilter(query)
const found = projectStore.searchSavedFilter(query)
foundProjects.value = found.filter(props.filter)
return
}
foundProjects.value = projectStore.searchProject(query)
const found = projectStore.searchProject(query)
foundProjects.value = found.filter(props.filter)
}
function select(p: IProject | null) {

View File

@ -381,6 +381,7 @@
<div class="control is-expanded">
<ProjectSearch
:ref="e => setFieldRef('moveProject', e)"
:filter="project => project.id !== task.projectId"
@update:modelValue="changeProject"
/>
</div>