mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-03 14:22:19 +02:00
socket-events: fix join
This commit is contained in:
parent
7287c6bcaa
commit
50037644c0
|
@ -1,17 +1,18 @@
|
||||||
import socket from "../socket";
|
import socket from "../socket";
|
||||||
import {store} from "../store";
|
import {store} from "../store";
|
||||||
import {switchToChannel} from "../router";
|
import {switchToChannel} from "../router";
|
||||||
|
import {ClientChan} from "../types";
|
||||||
|
import {toClientChan} from "../chan";
|
||||||
|
|
||||||
socket.on("join", function (data) {
|
socket.on("join", function (data) {
|
||||||
store.getters.initChannel(data.chan);
|
|
||||||
|
|
||||||
const network = store.getters.findNetwork(data.network);
|
const network = store.getters.findNetwork(data.network);
|
||||||
|
|
||||||
if (!network) {
|
if (!network) {
|
||||||
return;
|
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
|
// Queries do not automatically focus, unless the user did a whois
|
||||||
if (data.chan.type === "query" && !data.shouldOpen) {
|
if (data.chan.type === "query" && !data.shouldOpen) {
|
||||||
|
|
Loading…
Reference in a new issue