Fix attachment not being added if the task was not a kanban task

This commit is contained in:
kolaente 2021-01-28 21:24:22 +01:00
parent 23552b2b1b
commit 4df33d1152
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
2 changed files with 1 additions and 1 deletions

View file

@ -17,7 +17,6 @@ export default {
console.debug(`Uploaded attachments for task ${this.taskId}, response was`, r) console.debug(`Uploaded attachments for task ${this.taskId}, response was`, r)
if (r.success !== null) { if (r.success !== null) {
r.success.forEach(a => { r.success.forEach(a => {
this.$store.commit('attachments/removeById', a.id)
this.$store.dispatch('tasks/addTaskAttachment', { this.$store.dispatch('tasks/addTaskAttachment', {
taskId: this.taskId, taskId: this.taskId,
attachment: a, attachment: a,

View file

@ -41,6 +41,7 @@ export default {
addTaskAttachment(ctx, {taskId, attachment}) { addTaskAttachment(ctx, {taskId, attachment}) {
const t = ctx.rootGetters['kanban/getTaskById'](taskId) const t = ctx.rootGetters['kanban/getTaskById'](taskId)
if (t.task === null) { if (t.task === null) {
ctx.commit('attachments/add', attachment, {root: true})
return return
} }
t.task.attachments.push(attachment) t.task.attachments.push(attachment)