fix(kanban): move task to done bucket when it was marked done from the task detail view
This commit is contained in:
parent
3566b889be
commit
ed5feee33a
@ -130,7 +130,8 @@
|
||||
</DropdownItem>
|
||||
<DropdownItem
|
||||
v-tooltip="buckets.length <= 1 ? $t('project.kanban.deleteLast') : ''"
|
||||
:class="{'is-disabled': buckets.length <= 1, 'has-text-danger': true}"
|
||||
class="has-text-danger"
|
||||
:class="{'is-disabled': buckets.length <= 1}"
|
||||
icon-class="has-text-danger"
|
||||
icon="trash-alt"
|
||||
@click.stop="() => deleteBucketModal(bucket.id)"
|
||||
@ -520,9 +521,7 @@ async function updateTaskPosition(e) {
|
||||
}))
|
||||
newTask.done = updatedTaskBucket.taskDone
|
||||
if (updatedTaskBucket.bucketId !== newTask.bucketId) {
|
||||
kanbanStore.removeTaskInBucket(newTask)
|
||||
newTask.bucketId = updatedTaskBucket.bucketId
|
||||
kanbanStore.addTaskToBucket(newTask)
|
||||
kanbanStore.moveTaskToBucket(newTask, updatedTaskBucket.bucketId)
|
||||
}
|
||||
kanbanStore.setTaskInBucket(newTask)
|
||||
}
|
||||
|
@ -137,6 +137,12 @@ export const useKanbanStore = defineStore('kanban', () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function moveTaskToBucket(task: ITask, bucketId: IBucket['id']) {
|
||||
removeTaskInBucket(task)
|
||||
task.bucketId = bucketId
|
||||
addTaskToBucket(task)
|
||||
}
|
||||
|
||||
function addTaskToBucket(task: ITask) {
|
||||
const bucketIndex = findIndexById(buckets.value, task.bucketId)
|
||||
@ -330,6 +336,7 @@ export const useKanbanStore = defineStore('kanban', () => {
|
||||
setTaskInBucket,
|
||||
addTaskToBucket,
|
||||
removeTaskInBucket,
|
||||
moveTaskToBucket,
|
||||
loadBucketsForProject,
|
||||
loadNextTasksForBucket,
|
||||
createBucket,
|
||||
|
@ -625,6 +625,7 @@ import {scrollIntoView} from '@/helpers/scrollIntoView'
|
||||
import {useAttachmentStore} from '@/stores/attachments'
|
||||
import {useTaskStore} from '@/stores/tasks'
|
||||
import {useKanbanStore} from '@/stores/kanban'
|
||||
import {useBaseStore} from '@/stores/base'
|
||||
|
||||
import {useTitle} from '@/composables/useTitle'
|
||||
|
||||
@ -650,6 +651,7 @@ const router = useRouter()
|
||||
const {t} = useI18n({useScope: 'global'})
|
||||
|
||||
const projectStore = useProjectStore()
|
||||
const baseStore = useBaseStore()
|
||||
const attachmentStore = useAttachmentStore()
|
||||
const taskStore = useTaskStore()
|
||||
const kanbanStore = useKanbanStore()
|
||||
@ -872,7 +874,7 @@ async function deleteTask() {
|
||||
router.push({name: 'project.index', params: {projectId: task.value.projectId}})
|
||||
}
|
||||
|
||||
function toggleTaskDone() {
|
||||
async function toggleTaskDone() {
|
||||
const newTask = {
|
||||
...task.value,
|
||||
done: !task.value.done,
|
||||
@ -882,10 +884,18 @@ function toggleTaskDone() {
|
||||
playPopSound()
|
||||
}
|
||||
|
||||
saveTask(
|
||||
await saveTask(
|
||||
newTask,
|
||||
toggleTaskDone,
|
||||
)
|
||||
|
||||
if(task.value.done) {
|
||||
baseStore.currentProject?.views.forEach(v => {
|
||||
if (v.doneBucketId !== 0) {
|
||||
kanbanStore.moveTaskToBucket(task.value, v.doneBucketId)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function changeProject(project: IProject) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user