Add feature to join new party if user is in a party of one

This commit is contained in:
Blade Barringer
2015-08-22 12:19:37 -05:00
parent 8c66714e5f
commit 93f02363e5
6 changed files with 61 additions and 3 deletions
+3 -2
View File
@@ -577,8 +577,9 @@ var inviteByUUIDs = function(uuids, group, req, res, next){
return cb({code:400,err:"User already pending invitation."});
Group.find({type:'party', members:{$in:[uuid]}}, function(err, groups){
if (err) return cb(err);
if (!_.isEmpty(groups))
return cb({code:400,err:"User already in a party."})
if (!_.isEmpty(groups) && groups[0].members.length > 1) {
return cb({code:400, err:"User already in a party."})
}
sendInvite();
});
}