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:
parent
80c6e48b98
commit
25dee77600
@ -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, "");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user