Add auto-prepend behaviour for unprefixed channels

This change adds behaviour to automatically prefix channel names passed in via the "?join=x,y,z" query string/search parameter which do not appear to include an appropriate channel symbol.
This commit is contained in:
Adam Williams 2018-03-24 16:44:04 +00:00
parent 80c6e48b98
commit 25dee77600

View File

@ -585,7 +585,19 @@ $(function() {
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in#Iterating_over_own_properties_only
for (let key in params) {
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
key = key.replace(/\W/g, "");