socket-events: fix join

This commit is contained in:
Reto Brunner 2024-04-13 22:02:04 +02:00
parent 7287c6bcaa
commit 50037644c0

View file

@ -1,17 +1,18 @@
import socket from "../socket";
import {store} from "../store";
import {switchToChannel} from "../router";
import {ClientChan} from "../types";
import {toClientChan} from "../chan";
socket.on("join", function (data) {
store.getters.initChannel(data.chan);
const network = store.getters.findNetwork(data.network);
if (!network) {
return;
}
network.channels.splice(data.index || -1, 0, data.chan);
const clientChan: ClientChan = toClientChan(data.chan);
network.channels.splice(data.index || -1, 0, clientChan);
// Queries do not automatically focus, unless the user did a whois
if (data.chan.type === "query" && !data.shouldOpen) {