mirror of
https://github.com/jech/galene.git
synced 2024-11-09 18:25: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
|
||||
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) {
|
||||
let us = div.children;
|
||||
for(let i = 0; i < us.length; i++) {
|
||||
let child = us[i];
|
||||
let childuser =
|
||||
serverConnection.users[child.id.slice('user-'.length)] || null;
|
||||
let childid = child.id.slice('user-'.length);
|
||||
if(childid === serverConnection.id)
|
||||
continue;
|
||||
let childuser = serverConnection.users[childid] || null;
|
||||
let childname = (childuser && childuser.username) || null;
|
||||
if(!childname || stringCompare(childname, userinfo.username) > 0) {
|
||||
div.insertBefore(user, child);
|
||||
|
@ -1987,6 +1998,7 @@ function addUser(id, userinfo) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
div.appendChild(user);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue