mirror of
https://github.com/thelounge/thelounge
synced 2024-11-29 15:30:22 +00:00
Merge pull request #2289 from lol768/master
Add auto-prepend behaviour for unprefixed channel names
This commit is contained in:
commit
fe08547d6b
1 changed files with 13 additions and 1 deletions
|
@ -414,7 +414,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 a new issue