Ensure correct join/leave button for parties

This commit is contained in:
Kevin Gisi
2015-04-24 11:54:00 -04:00
parent 523582f870
commit 65e42345f2
2 changed files with 20 additions and 1 deletions

View File

@@ -23,6 +23,12 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '
return _.detect(Groups.myGuilds(), function(g) { return g._id === group._id });
}
// Similarly, if we're dealing with the user's current party, return true.
if(group.type === 'party') {
var currentParty = Groups.party();
if(currentParty._id && currentParty._id === group._id) return true;
}
if (!group.members) return false;
var memberIds = _.map(group.members, function(x){return x._id});
return ~(memberIds.indexOf(userid));