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,14 +361,13 @@ $(function() {
let value = params[key];
if (key === "join") {
const channels = value.split(",");
value = channels.map((c) => {
if (c.match(/^\w/)) {
return "#" + c;
value = value.split(",").map((chan) => {
if (!chan.match(/^[#&!+]/)) {
return `#${chan}`;
}
return c;
}).join(",");
return chan;
}).join(", ");
}
// \W searches for non-word characters

View File

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