Merge branch 'develop' into sabrecat/teams-rebase

This commit is contained in:
SabreCat
2022-03-23 20:23:29 -05:00
63 changed files with 454 additions and 276 deletions

View File

@@ -161,6 +161,21 @@ api.groupMoveTask = {
const order = group.tasksOrder[`${task.type}s`];
if (order.indexOf(task._id) === -1) { // task is missing from list, list needs repair
const taskList = await Tasks.Task.find(
{ 'group.id': group._id, userId: { $exists: false }, type: task.type },
{ _id: 1 },
).exec();
for (const foundTask of taskList) {
if (order.indexOf(foundTask._id) === -1) {
order.push(foundTask._id);
}
}
const fixQuery = { $set: {} };
fixQuery.$set[`tasksOrder.${task.type}s`] = order;
await group.update(fixQuery).exec();
}
moveTask(order, task._id, to);
await group.save();