From 4050e9ad0c16dfb9449d04d0a3e737dd76413768 Mon Sep 17 00:00:00 2001 From: Blade Barringer Date: Tue, 12 May 2015 22:28:06 -0500 Subject: [PATCH] =?UTF-8?q?Fix=20guilds=20not=20loading=20=EF=BC=BC(^?= =?UTF-8?q?=CF=89^=EF=BC=BC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- website/src/controllers/groups.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/website/src/controllers/groups.js b/website/src/controllers/groups.js index 831a1bcb39..61a446e426 100644 --- a/website/src/controllers/groups.js +++ b/website/src/controllers/groups.js @@ -148,14 +148,20 @@ api.get = function(req, res, next) { //If the group is private or the group is a party, then the user must be a member of the group based on access restrictions above if (group.privacy === 'private' || gid === 'party') { //If the user is not in the group query, remove a user and add the current user - if (!userInGroup) { group.members.pop().push(user); } + if (!userInGroup) { + group.members.splice(0,1); + group.members.push(user); + } res.json(group); } else if ( group.privacy === "public" ) { //The group is public, we must do an extra check to see if the user is already in the group query //We must see how to check if a user is a member of a public group, so we requery var q2 = Group.findOne({ _id: group._id, privacy:'public', members: {$in:[user._id]} }); q2.exec(function(err, group2){ if (err) return next(err); - if (group2 && !userInGroup) { group.members.pop().push(user); } + if (group2 && !userInGroup) { + group.members.splice(0,1); + group.members.push(user); + } res.json(group); }); }