thelounge/client/js/socket-events/join.js

24 lines
511 B
JavaScript
Raw Normal View History

2017-05-18 22:08:54 +02:00
"use strict";
const socket = require("../socket");
const {vueApp, initChannel, findNetwork} = require("../vue");
2017-05-18 22:08:54 +02:00
socket.on("join", function(data) {
initChannel(data.chan);
const network = findNetwork(data.network);
if (!network) {
return;
}
network.channels.splice(data.index || -1, 0, data.chan);
2017-05-18 22:08:54 +02:00
// Queries do not automatically focus, unless the user did a whois
if (data.chan.type === "query" && !data.shouldOpen) {
return;
}
2019-10-25 23:37:40 +02:00
vueApp.switchToChannel(vueApp.findChannel(data.chan.id));
2017-05-18 22:08:54 +02:00
});