Added tests to ensure challenge member can not delete active challenge task and can delete broken or unlinked challenge task

This commit is contained in:
Keith Holliday
2016-03-15 10:03:48 -05:00
parent c04e53b5a5
commit 534ec07b6a
2 changed files with 60 additions and 1 deletions

View File

@@ -914,7 +914,7 @@ api.deleteTask = {
if (challenge.leader !== user._id) throw new NotAuthorized(res.t('onlyChalLeaderEditTasks'));
} else if (task.userId !== user._id) { // If the task is owned by an user make it's the current one
throw new NotFound(res.t('taskNotFound'));
} else if (task.userId && task.challenge.id) {
} else if (task.userId && task.challenge.id && !task.challenge.broken) {
throw new NotAuthorized(res.t('cantDeleteChallengeTasks'));
}