fix: direct store manipulation in tasks (#1534)
Co-authored-by: Dominik Pschenitschni <mail@celement.de> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/1534 Reviewed-by: konrad <k@knt.li> Co-authored-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de> Co-committed-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
This commit is contained in:
parent
8df73c973b
commit
c419062e49
1 changed files with 36 additions and 30 deletions
|
@ -133,9 +133,19 @@ export default {
|
||||||
console.debug('Could not add assignee to task in kanban, task not found', t)
|
console.debug('Could not add assignee to task in kanban, task not found', t)
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
// FIXME: direct store manipulation (task)
|
|
||||||
t.task.assignees.push(user)
|
const assignees = [
|
||||||
ctx.commit('kanban/setTaskInBucketByIndex', t, { root: true })
|
...t.task.assignees,
|
||||||
|
user,
|
||||||
|
]
|
||||||
|
|
||||||
|
ctx.commit('kanban/setTaskInBucketByIndex', {
|
||||||
|
...t,
|
||||||
|
task: {
|
||||||
|
...t.task,
|
||||||
|
assignees,
|
||||||
|
},
|
||||||
|
}, {root: true})
|
||||||
return r
|
return r
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -153,15 +163,15 @@ export default {
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const a in t.task.assignees) {
|
const assignees = t.task.assignees.filter(({ id }) => id !== user.id)
|
||||||
if (t.task.assignees[a].id === user.id) {
|
|
||||||
// FIXME: direct store manipulation (task)
|
|
||||||
t.task.assignees.splice(a, 1)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.commit('kanban/setTaskInBucketByIndex', t, {root: true})
|
ctx.commit('kanban/setTaskInBucketByIndex', {
|
||||||
|
...t,
|
||||||
|
task: {
|
||||||
|
...t.task,
|
||||||
|
assignees,
|
||||||
|
},
|
||||||
|
}, {root: true})
|
||||||
return response
|
return response
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -179,17 +189,19 @@ export default {
|
||||||
console.debug('Could not add label to task in kanban, task not found', t)
|
console.debug('Could not add label to task in kanban, task not found', t)
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
const labels = [...t.task.labels]
|
const labels = [
|
||||||
labels.push(label)
|
...t.task.labels,
|
||||||
|
label,
|
||||||
|
]
|
||||||
|
|
||||||
ctx.commit('kanban/setTaskInBucketByIndex', {
|
ctx.commit('kanban/setTaskInBucketByIndex', {
|
||||||
task: {
|
|
||||||
labels,
|
|
||||||
...t.task,
|
|
||||||
},
|
|
||||||
...t,
|
...t,
|
||||||
}, { root: true })
|
task: {
|
||||||
|
...t.task,
|
||||||
|
labels,
|
||||||
|
},
|
||||||
|
}, {root: true})
|
||||||
|
|
||||||
return r
|
return r
|
||||||
},
|
},
|
||||||
|
@ -209,20 +221,14 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the label from the list
|
// Remove the label from the list
|
||||||
const labels = [...t.task.labels]
|
const labels = t.task.labels.filter(({ id }) => id !== label.id)
|
||||||
for (const l in labels) {
|
|
||||||
if (labels[l].id === label.id) {
|
|
||||||
labels.splice(l, 1)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx.commit('kanban/setTaskInBucketByIndex', {
|
ctx.commit('kanban/setTaskInBucketByIndex', {
|
||||||
task: {
|
|
||||||
labels,
|
|
||||||
...t.task,
|
|
||||||
},
|
|
||||||
...t,
|
...t,
|
||||||
|
task: {
|
||||||
|
...t.task,
|
||||||
|
labels,
|
||||||
|
},
|
||||||
}, {root: true})
|
}, {root: true})
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
Loading…
Reference in a new issue