chore: refactor removing a related task

This commit is contained in:
kolaente 2021-11-03 21:53:27 +01:00
parent ce5de84c84
commit 2f28b43243
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 7 additions and 12 deletions

View File

@ -242,19 +242,14 @@ export default {
try { try {
await this.taskRelationService.delete(rel) await this.taskRelationService.delete(rel)
outer: const kind = this.relationToDelete.relationKind
for (const kind in this.relatedTasks) { for (const t in this.relatedTasks[kind]) {
for (const t in this.relatedTasks[kind]) { if (this.relatedTasks[kind][t].id === this.relationToDelete.otherTaskId) {
const found = typeof this.relatedTasks[kind][t] !== 'undefined' && this.relatedTasks[kind].splice(t, 1)
this.relatedTasks[kind][t].id === this.relationToDelete.otherTaskId &&
kind === this.relationToDelete.relationKind
if (!found) continue
this.relatedTasks[kind].splice(t, 1) break
break outer
}
} }
}
this.saved = true this.saved = true
setTimeout(() => { setTimeout(() => {
@ -364,7 +359,7 @@ $remove-icon-width: 24px;
} }
} }
} }
&:hover .tasks .task .remove { &:hover .tasks .task .remove {
opacity: 1; opacity: 1;
} }