Improved filter function as described in #5085 and added unit tests.

This commit is contained in:
Joy Clark
2015-04-26 17:50:53 +02:00
parent c324ea3e03
commit f214428411
3 changed files with 16 additions and 11 deletions

View File

@@ -220,11 +220,11 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '
$scope.usernames = [];
}
$scope.filterUser = function(userItem) {
$scope.filterUser = function(msg) {
if ($scope.query === undefined || $scope.query === null) {
return true;
return false;
}
return userItem.user.indexOf($scope.query.text) == 0; // query should be prefix of item.user
return msg.user.indexOf($scope.query.text) == 0; // query should be prefix of item.user
}
$scope.addNewUser = function(user) {