Fixed bug where user wasn't really removed. Changed popup depending on if user was in challenges. Fixed selectedChal typo

This commit is contained in:
Cole Gleason
2014-01-06 23:06:14 -06:00
parent 744d8a6780
commit b10c29f02f
2 changed files with 21 additions and 5 deletions
+2
View File
@@ -316,6 +316,8 @@ api.leave = function(req, res, next) {
// Unlink the challenge tasks from user
async.waterfall(challenges.map(function(chal) {
return function(cb) {
var i = user.challenges.indexOf(chal._id)
if (~i) user.challenges.splice(i,1);
user.unlink({cid:chal._id, keep:keep}, function(err){
if (err) return cb(err);
cb(null);