Only send /join for current channel if there are no arguments

This commit is contained in:
Pavel Djundik 2018-09-25 19:52:22 +03:00
parent 7ba14fe4e3
commit 5f0f745d10

View File

@ -3,18 +3,22 @@
const $ = require("jquery");
exports.input = function(args) {
const channel = args[0];
const utils = require("../utils");
const socket = require("../socket");
const {vueApp} = require("../vue");
if (channel) {
if (args.length > 0) {
const channel = args[0];
if (channel.length > 0) {
const chan = utils.findCurrentNetworkChan(channel);
if (chan) {
$(`#sidebar .chan[data-id="${chan.id}"]`).trigger("click");
}
}
} else if (vueApp.activeChannel.channel.type === "channel") {
// If `/join` command is used without any arguments, re-join current channel
socket.emit("input", {
target: vueApp.activeChannel.channel.id,
text: `/join ${vueApp.activeChannel.channel.name}`,