[#1710] fix to party-in-header

This commit is contained in:
Tyler Renelle
2013-11-01 20:32:43 -07:00
parent 62b2d5780b
commit 87bc7fd722
3 changed files with 8 additions and 9 deletions

View File

@@ -2,9 +2,10 @@
habitrpg.controller("HeaderCtrl", ['$scope', 'Groups', 'User',
function($scope, Groups, User) {
$scope.party = Groups.party();
$scope.partyMinusSelf = _.filter($scope.party, function(member){
return member._id !== User.user._id;
$scope.party = Groups.party(function(){
$scope.partyMinusSelf = _.filter($scope.party.members, function(member){
return member._id !== User.user._id;
});
});
}
]);

View File

@@ -22,12 +22,10 @@ angular.module('groupServices', ['ngResource']).
// Defer loading everything until they're requested
var party, myGuilds, publicGuilds, tavern;
// But we don't defer triggering Party, since we always need it for the header if nothing else
party = Group.get({gid: 'party'});
return {
party: function(){
return party;
party: function(cb){
if (!party) return (party = Group.get({gid: 'party'}, cb));
return (cb) ? cb(party) : party;
},
publicGuilds: function(){
//TODO combine these as {type:'guilds,public'} and create a $filter() to separate them

View File

@@ -27,7 +27,7 @@
i.icon-signal
// party
span(ng-controller='PartyCtrl')
.herobox-wrap(ng-repeat='profile in party.members | filter:removeSelf')
.herobox-wrap(ng-repeat='profile in partyMinusSelf')
include avatar
.NPC-Bailey-Head(ng-show='user.flags.newStuff', tooltip='Psst', tooltip-placement='top', ng-click='modals.newStuff=true')