Simplify group detection logic for guilds

This commit is contained in:
Kevin Gisi
2015-04-15 23:10:12 -04:00
parent d455666650
commit 160982df33

View File

@@ -20,9 +20,7 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '
// If the group is a guild, just check for an intersection with the
// current user's guilds, rather than checking the members of the group.
if(group.type === 'guild') {
if (_.detect(Groups.myGuilds(), function(g) { return g._id === group._id })) {
return true;
}
return _.detect(Groups.myGuilds(), function(g) { return g._id === group._id });
}
if (!group.members) return false;