mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
a proposed solution to issue #1866 Redefined the filter function to match based on prefix
This commit is contained in:
@@ -220,6 +220,13 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '
|
||||
$scope.usernames = [];
|
||||
}
|
||||
|
||||
$scope.filterUser = function(item) {
|
||||
if ($scope.query === undefined || $scope.query === null) {
|
||||
return true;
|
||||
}
|
||||
return item.user.indexOf($scope.query.text) == 0; // query should be prefix of item.user
|
||||
}
|
||||
|
||||
$scope.addNewUser = function(user) {
|
||||
if($.inArray(user.user,$scope.usernames) == -1) {
|
||||
user.username = user.user;
|
||||
|
||||
@@ -15,7 +15,7 @@ form.chat-form(ng-if='user.flags.communityGuidelinesAccepted' ng-submit='postCha
|
||||
textarea.form-control(rows=4, ui-keydown='{"meta-enter":"postChat(group,message.content)"}', ui-keypress='{13:"postChat(group,message.content)"}', ng-model='message.content', updateinterval='250', flag='@', at-user, auto-complete placeholder="{{group._id == 'habitrpg' ? env.t('tavernCommunityGuidelinesPlaceholder') : ''}}")
|
||||
span.user-list(ng-show='!isAtListHidden')
|
||||
ul.list-at-user
|
||||
li(ng-repeat='user in response | filter:query.text | limitTo: 5', ng-click='autoComplete(user)')
|
||||
li(ng-repeat='user in response | filter:filterUser | limitTo: 5', ng-click='autoComplete(user)')
|
||||
span.username.label.label-default(ng-class=':: userLevelStyle(user)') {{::user.user}}
|
||||
.chat-controls
|
||||
.chat-formatting
|
||||
|
||||
Reference in New Issue
Block a user