-
Notifications
You must be signed in to change notification settings - Fork 681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add auto-prepend behaviour for unprefixed channel names #2289
Conversation
client/js/lounge.js
Outdated
|
||
if (key === "join") { | ||
let channels = value.split(","); | ||
channels = _.map(channels, (c) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a native method instead of bringing lodash here (we don't use it on the client).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've addressed this and squashed the commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works fine.
client/js/lounge.js
Outdated
|
||
return c; | ||
}); | ||
value = channels.join(","); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can chain value = split.map.join
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good shout, changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you push the change? Doesn't appear to be changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would seem I didn't git add
before amending the commit. Fixed now in 25dee77
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.
👍 from me |
@MaxLeiter You can review/approve the PR from files changed tab. |
Would it work if, instead of adding |
We could certainly make the decision to limit it to those characters (and have some centralised logic somewhere for fetching/checking for channel type characters). |
What do @xPaw and/or @McInkay prefer? |
Ideally we should use chantypes from the server, no? |
We don't know them before connecting. |
Hmmm, but this is just for joining channels, isn't it? So we should already be on the network. |
This is joining from the connect window. It would be way more complicated to wait for server to connect then fix channels. |
In that case, I'd prefer the current solution than just using |
Alright then. I still think we should check for chan prefixes (and we can probably do it statically by including chan types that might not be on this specific server), but I guess this is the most conservative approach. |
(I'm merging as-is despite the CI failures, the linting issue reported is not caused by this PR and was fixed on |
Thanks a lot @lol768 and congrats on your first merged PR!! :) 🎉 |
Hey @lol768, we have sticker packs for our contributors now! |
Awesome stuff @astorije 😄 - filled in the form! |
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. For example,
channel
becomes#channel
but#channel
and~channel
are left alone.Known limitation: Unicode characters at the start of the channel name will not be considered to match
/^\w/
. These will not be auto-prefixed.If this is not the correct place to implement this functionality, please let me know where it would be better suited.