mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 04:12:46 +02:00
simpler filter code
This commit is contained in:
parent
5ece3f1e1a
commit
8aae2aa5f0
1 changed files with 5 additions and 4 deletions
|
@ -364,12 +364,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isOtherUsers(user) {
|
||||||
|
return user.username != myUsername;
|
||||||
|
}
|
||||||
|
|
||||||
function processData(data, type) {
|
function processData(data, type) {
|
||||||
// Filter out yourself from the users list
|
// Filter out yourself from the users list
|
||||||
var removeIndex = data.users.map(function(user) { return user.username }).indexOf(myUsername);
|
data.users = data.users.filter(isOtherUsers);
|
||||||
if (removeIndex >= 0) {
|
|
||||||
data.users.splice(removeIndex,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sort array alphabetically by username
|
// Sort array alphabetically by username
|
||||||
data.users.sort(function(a, b) {
|
data.users.sort(function(a, b) {
|
||||||
|
|
Loading…
Reference in a new issue