1
0

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

(cherry picked from commit 7efc4d1bc890b4a12ee30274eaeb6062f4e49510)
This commit is contained in:
kolaente 2024-08-12 15:18:00 +02:00
parent 53605c24f0
commit 715269a5d0
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B
3 changed files with 8 additions and 3 deletions

View File

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

View File

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

View File

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