mirror of
https://github.com/thelounge/thelounge
synced 2025-02-16 21:28:23 +00:00
The sort event bundled networks and channels for no reason at all. They share none of the actual logic, so combining them just makes the typing poor but serves no benefit.
16 lines
449 B
TypeScript
16 lines
449 B
TypeScript
import socket from "../socket";
|
|
import {store} from "../store";
|
|
|
|
socket.on("sync_sort:networks", function (data) {
|
|
store.commit("sortNetworks", (a, b) => data.order.indexOf(a.uuid) - data.order.indexOf(b.uuid));
|
|
});
|
|
|
|
socket.on("sync_sort:channels", function (data) {
|
|
const network = store.getters.findNetwork(data.network);
|
|
|
|
if (!network) {
|
|
return;
|
|
}
|
|
|
|
network.channels.sort((a, b) => data.order.indexOf(a.id) - data.order.indexOf(b.id));
|
|
});
|