mirror of
https://github.com/thelounge/thelounge
synced 2024-11-26 22:10:22 +00:00
Enforce lobby to be the first 0th channel when sorting
This commit is contained in:
parent
b3fcea866c
commit
0519c8a857
1 changed files with 11 additions and 1 deletions
|
@ -452,7 +452,17 @@ Client.prototype.sort = function(data) {
|
|||
return;
|
||||
}
|
||||
|
||||
network.channels.sort((a, b) => order.indexOf(a.id) - order.indexOf(b.id));
|
||||
network.channels.sort((a, b) => {
|
||||
// Always sort lobby to the top regardless of what the client has sent
|
||||
// Because there's a lot of code that presumes channels[0] is the lobby
|
||||
if (a.type === Chan.Type.LOBBY) {
|
||||
return -1;
|
||||
} else if (b.type === Chan.Type.LOBBY) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return order.indexOf(a.id) - order.indexOf(b.id);
|
||||
});
|
||||
|
||||
// Sync order to connected clients
|
||||
this.emit("sync_sort", {
|
||||
|
|
Loading…
Reference in a new issue