Add prefix to channels from connect window

Fixes #2327
This commit is contained in:
Pavel Djundik 2018-04-22 21:04:59 +03:00
parent 5e1beb5b46
commit 426893077f
2 changed files with 10 additions and 7 deletions

View File

@ -361,13 +361,12 @@ $(function() {
let value = params[key]; let value = params[key];
if (key === "join") { if (key === "join") {
const channels = value.split(","); value = value.split(",").map((chan) => {
value = channels.map((c) => { if (!chan.match(/^[#&!+]/)) {
if (c.match(/^\w/)) { return `#${chan}`;
return "#" + c;
} }
return c; return chan;
}).join(", "); }).join(", ");
} }

View File

@ -177,7 +177,11 @@ Client.prototype.connect = function(args) {
channels = args.join channels = args.join
.replace(/,/g, " ") .replace(/,/g, " ")
.split(/\s+/g) .split(/\s+/g)
.map(function(chan) { .map((chan) => {
if (!chan.match(/^[#&!+]/)) {
chan = `#${chan}`;
}
return client.createChannel({ return client.createChannel({
name: chan, name: chan,
}); });