From 58986c4a7a36154640e3128e4c8e0c1c3935c801 Mon Sep 17 00:00:00 2001 From: konrad Date: Thu, 4 Nov 2021 16:30:30 +0000 Subject: [PATCH] fix: adding or creating a label with quick add magic (#944) Co-authored-by: kolaente Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/944 Reviewed-by: dpschen Co-authored-by: konrad Co-committed-by: konrad --- src/store/modules/tasks.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/store/modules/tasks.js b/src/store/modules/tasks.js index 8adf09bb..70e5370c 100644 --- a/src/store/modules/tasks.js +++ b/src/store/modules/tasks.js @@ -223,13 +223,12 @@ export default { const labelAddsToWaitFor = parsedLabels.map(async labelTitle => { let label = validateLabel(labels, labelTitle) - if (typeof label !== 'undefined') { - return label + if (typeof label === 'undefined') { + // label not found, create it + const labelModel = new LabelModel({title: labelTitle}) + label = await dispatch('labels/createLabel', labelModel, {root: true}) } - // label not found, create it - const labelModel = new LabelModel({title: labelTitle}) - await dispatch('labels/createLabel', labelModel, {root: true}) return addLabelToTask(task, label) })