fix trying to move completed todos

This commit is contained in:
Matteo Pagliazzi
2015-11-30 20:22:22 +01:00
parent 67bcfde6dc
commit 93fcc7957e
2 changed files with 3 additions and 1 deletions

View File

@@ -22,5 +22,6 @@
"checklistOnlyDailyTodo": "Checklists are supported only on dailies and todos",
"checklistItemNotFound": "No checklist item was wound with given id.",
"itemIdRequired": "\"itemId\" must be a valid UUID",
"positionRequired": "\"position\" is required and must be a number."
"positionRequired": "\"position\" is required and must be a number.",
"cantMoveCompletedTodo": "Can't move a completed todo."
}

View File

@@ -172,6 +172,7 @@ api.moveTask = {
}).exec()
.then((task) => {
if (!task) throw new NotFound(res.t('taskNotFound'));
if (task.type === 'todo' && task.completed) throw new NotFound(res.t('cantMoveCompletedTodo'));
let order = user.tasksOrder[`${task.type}s`];
let currentIndex = order.indexOf(task._id);