From f884020c55a9761f2d3cb38d44e87db913fa475e Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 17 Oct 2021 13:46:56 +0200 Subject: [PATCH] fix: creating a new task while specifying the list in quick add magic --- src/store/modules/tasks.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/store/modules/tasks.js b/src/store/modules/tasks.js index cb5c6633..618b36b5 100644 --- a/src/store/modules/tasks.js +++ b/src/store/modules/tasks.js @@ -264,7 +264,7 @@ export default { // label not found, create it const labelModel = new LabelModel({title: labelTitle}) - return dispatch('labels/createLabel', labelModel).then(() => resolve(label)) + return dispatch('labels/createLabel', labelModel, {root: true}).then(() => resolve(label)) }) .then((label) => addLabelToTask(task, label)) .catch(e => Promise.reject(e)), @@ -274,18 +274,18 @@ export default { return Promise.all(labelAddsToWaitFor).then(() => task) }, - findListId({ rootGetters }, { list, listId }) { + findListId({ rootGetters }, { list: listName, listId }) { let foundListId = null // Uses the following ways to get the list id of the new task: // 1. If specified in quick add magic, look in store if it exists and use it if it does - if (list !== null) { - const list = rootGetters['lists/findListByExactname'](list) + if (listName !== null) { + const list = rootGetters['lists/findListByExactname'](listName) foundListId = list === null ? null : list.id } // 2. Else check if a list was passed as parameter - if (listId !== 0) { + if (foundListId === null && listId !== 0) { foundListId = listId } @@ -334,7 +334,7 @@ export default { return taskService.create(task) .then(task => dispatch('addLabelsToTask', { task, - parsedLabels:parsedTask.labels, + parsedLabels: parsedTask.labels, })) .catch(e => Promise.reject(e)) },