mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 08:55:47 +01:00
removed one of the timeouts in user search
This commit is contained in:
@@ -47,7 +47,6 @@ define(function() {
|
||||
|
||||
$('#user-notfound-notify').html('<i class="fa fa-spinner fa-spin"></i>');
|
||||
|
||||
setTimeout(function() {
|
||||
socket.emit('user.search', username, function(err, data) {
|
||||
if(err) {
|
||||
return app.alert(err.message);
|
||||
@@ -76,7 +75,6 @@ define(function() {
|
||||
});
|
||||
});
|
||||
});
|
||||
}, 500); //replace this with global throttling function/constant
|
||||
|
||||
}, 250);
|
||||
});
|
||||
|
||||
@@ -18,10 +18,15 @@ module.exports = function(User) {
|
||||
query = query.toLowerCase();
|
||||
|
||||
var usernames = Object.keys(usernamesHash);
|
||||
var uids = usernames.filter(function(username) {
|
||||
return username.toLowerCase().indexOf(query) === 0;
|
||||
})
|
||||
.slice(0, 10)
|
||||
var uids = [];
|
||||
|
||||
for(var i=0; i<usernames.length; ++i) {
|
||||
if (usernames[i].toLowerCase().indexOf(query) === 0) {
|
||||
uids.push(usernames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
uids = uids.slice(0, 10)
|
||||
.sort(function(a, b) {
|
||||
return a > b;
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user