diff --git a/cypress/integration/list/list.spec.js b/cypress/integration/list/list.spec.js index 8242984e69..3d597c79cb 100644 --- a/cypress/integration/list/list.spec.js +++ b/cypress/integration/list/list.spec.js @@ -446,7 +446,7 @@ describe('Lists', () => { cy.get('.kanban .bucket .tasks .task') .contains(tasks[0].title) .first() - .drag('.kanban .bucket:nth-child(2) .tasks .dropper div') + .drag('.kanban .bucket:nth-child(2) .tasks .dropper') cy.get('.kanban .bucket:nth-child(2) .tasks') .should('contain', tasks[0].title) diff --git a/src/store/modules/kanban.js b/src/store/modules/kanban.js index b3de7e5376..e10aeea476 100644 --- a/src/store/modules/kanban.js +++ b/src/store/modules/kanban.js @@ -378,43 +378,6 @@ export default { .finally(() => cancel()) }, - updateBuckets(ctx, updatedBucketsData) { - const cancel = setLoading(ctx, 'kanban') - - const oldBuckets = [] - const updatedBuckets = updatedBucketsData.map((updatedBucketData) => { - const bucketIndex = findIndexById(ctx.state.buckets, updatedBucketData.id) - const bucket = ctx.state.buckets[bucketIndex] - - const oldBucket = cloneDeep(bucket) - oldBuckets.push(oldBucket) - - const newBucket = { - // FIXME: maybe optional to set the original value as well - ...bucket, - id: updatedBucketData.id, - listId: updatedBucketData.listId || oldBucket.listId, - ...updatedBucketData, - } - ctx.commit('setBucketByIndex', {bucketIndex, bucket: newBucket}) - - const bucketService = new BucketService() - return bucketService.update(newBucket) - }) - - return Promise.all(updatedBuckets) - .then(r => { - Promise.resolve(r) - }) - .catch(e => { - // restore original state - Object.values(updatedBuckets).forEach((oldBucket) => ctx.commit('setBucketById', oldBucket)) - - return Promise.reject(e) - }) - .finally(() => cancel()) - }, - updateBucketTitle(ctx, { id, title }) { const bucket = findById(ctx.state.buckets, id) diff --git a/src/views/list/views/Kanban.vue b/src/views/list/views/Kanban.vue index 16abf81549..2e23758cc6 100644 --- a/src/views/list/views/Kanban.vue +++ b/src/views/list/views/Kanban.vue @@ -19,11 +19,11 @@ :class="{ 'is-loading': loading && !oneTaskUpdating}" class="kanban kanban-bucket-container loader-container" > - state.kanban.listId, @@ -424,9 +418,6 @@ export default { const taskBefore = newBucket.tasks[e.newIndex - 1] ?? null const taskAfter = newBucket.tasks[e.newIndex + 1] ?? null - // task.kanbanPosition = calculateItemPosition(taskBefore !== null ? taskBefore.kanbanPosition : null, taskAfter !== null ? taskAfter.kanbanPosition : null) - // task.bucketId = newBucket.id - const newTask = { ...task, bucketId: newBucket.id, @@ -522,10 +513,13 @@ export default { }) }, - updateBucketPositions(buckets) { - this.$store.dispatch('kanban/updateBuckets', buckets) + updateBuckets(value) { + // (1) buckets get updated in store and tasks positions get invalidated + this.$store.commit('kanban/setBuckets', value) }, + updateBucketPosition(e) { + // (2) bucket positon is changed this.dragBucket = false const bucket = this.buckets[e.newIndex]