fix(tasks): correct list repair query

This commit is contained in:
SabreCat
2022-03-18 17:40:09 -05:00
parent 4a21ffa81d
commit 2828ae660c

View File

@@ -839,7 +839,10 @@ api.moveTask = {
// In memory updates
const order = owner.tasksOrder[`${task.type}s`];
if (order.indexOf(task._id) === -1) { // task is missing from list, list needs repair
const taskList = await Tasks.Task.find({ type: task.type }, { _id: 1 }).exec();
const taskList = await Tasks.Task.find(
{ userId: owner._id, type: task.type },
{ _id: 1 },
).exec();
for (const foundTask of taskList) {
if (order.indexOf(foundTask._id) === -1) {
order.push(foundTask._id);