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