mirror of
https://github.com/jech/galene.git
synced 2024-11-10 02:35:58 +01:00
Keep self at top of user list.
This commit is contained in:
parent
d2dff184d1
commit
968390942c
1 changed files with 15 additions and 3 deletions
|
@ -1974,12 +1974,23 @@ function addUser(id, userinfo) {
|
||||||
else
|
else
|
||||||
user.classList.remove('user-status-raisehand');
|
user.classList.remove('user-status-raisehand');
|
||||||
|
|
||||||
|
let us = div.children;
|
||||||
|
|
||||||
|
if(id === serverConnection.id) {
|
||||||
|
if(us.length === 0)
|
||||||
|
div.appendChild(user);
|
||||||
|
else
|
||||||
|
div.insertBefore(user, us[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(userinfo.username) {
|
if(userinfo.username) {
|
||||||
let us = div.children;
|
|
||||||
for(let i = 0; i < us.length; i++) {
|
for(let i = 0; i < us.length; i++) {
|
||||||
let child = us[i];
|
let child = us[i];
|
||||||
let childuser =
|
let childid = child.id.slice('user-'.length);
|
||||||
serverConnection.users[child.id.slice('user-'.length)] || null;
|
if(childid === serverConnection.id)
|
||||||
|
continue;
|
||||||
|
let childuser = serverConnection.users[childid] || null;
|
||||||
let childname = (childuser && childuser.username) || null;
|
let childname = (childuser && childuser.username) || null;
|
||||||
if(!childname || stringCompare(childname, userinfo.username) > 0) {
|
if(!childname || stringCompare(childname, userinfo.username) > 0) {
|
||||||
div.insertBefore(user, child);
|
div.insertBefore(user, child);
|
||||||
|
@ -1987,6 +1998,7 @@ function addUser(id, userinfo) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
div.appendChild(user);
|
div.appendChild(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue