mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
Adding a couple of watch statements should make the party order auto-update on changes.
This commit is contained in:
@@ -4,9 +4,20 @@ habitrpg.controller("HeaderCtrl", ['$scope', 'Groups', 'User',
|
||||
function($scope, Groups, User) {
|
||||
|
||||
$scope.Math = window.Math;
|
||||
$scope.user = User.user;
|
||||
|
||||
$scope.party = Groups.party(function(){
|
||||
$scope.partyMinusSelf = _.sortBy(
|
||||
var triggerResort = function() {
|
||||
$scope.partyMinusSelf = resortParty();
|
||||
};
|
||||
|
||||
triggerResort();
|
||||
$scope.$watch('user.party.order', triggerResort);
|
||||
$scope.$watch('user.party.orderAscending', triggerResort);
|
||||
});
|
||||
|
||||
function resortParty() {
|
||||
var result = _.sortBy(
|
||||
_.filter($scope.party.members, function(member){
|
||||
return member._id !== User.user._id;
|
||||
}),
|
||||
@@ -41,8 +52,10 @@ habitrpg.controller("HeaderCtrl", ['$scope', 'Groups', 'User',
|
||||
}
|
||||
)
|
||||
if (User.user.party.orderAscending == "descending") {
|
||||
$scope.partyMinusSelf = $scope.partyMinusSelf.reverse()
|
||||
result = result.reverse()
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user