Merge pull request #2289 from lol768/master

Add auto-prepend behaviour for unprefixed channel names
This commit is contained in:
Jérémie Astori 2018-03-29 01:19:45 -04:00 committed by GitHub
commit fe08547d6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -414,7 +414,19 @@ $(function() {
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in#Iterating_over_own_properties_only // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in#Iterating_over_own_properties_only
for (let key in params) { for (let key in params) {
if (params.hasOwnProperty(key)) { if (params.hasOwnProperty(key)) {
const value = params[key]; let value = params[key];
if (key === "join") {
const channels = value.split(",");
value = channels.map((c) => {
if (c.match(/^\w/)) {
return "#" + c;
}
return c;
}).join(",");
}
// \W searches for non-word characters // \W searches for non-word characters
key = key.replace(/\W/g, ""); key = key.replace(/\W/g, "");