Skip to content
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

Store channels in array format #417

Merged
merged 1 commit into from
Jul 3, 2016
Merged

Store channels in array format #417

merged 1 commit into from
Jul 3, 2016

Conversation

xPaw
Copy link
Member

@xPaw xPaw commented Jun 19, 2016

Preliminary support for #412.
19-171141094

@xPaw xPaw added the Type: Feature Tickets that describe a desired feature or PRs that add them to the project. label Jun 19, 2016
@xPaw xPaw added this to the 2.0.0 milestone Jun 19, 2016
@xPaw xPaw force-pushed the xpaw/channels branch 2 times, most recently from 82f0f61 to a95eb89 Compare June 19, 2016 17:37
if (args.channels) {
channels = args.channels.map(function(chan) {
if (!chan.name) {
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should print an error message there to let the user know that a channel has been ignored instead of just aborting like that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would we even print though? "A channel with no name was ignored"? That doesn't seem particularly useful.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like Channel X for network X for user Y is invalid, ignoring should do. The message doesn't have to be all that useful, it's just a matter of letting the user that something is wrong with their config, so the user isn't there "well, it loads my config fine and all but it doesn't join my channel!". I would be ok even with Invalid channel in config, the point really is just to give a hint to the user that an error happened.

Personally I would flat out crash (correctness > working), but that won't make a lot of happy people :P

@maxpoulin64
Copy link
Member

Nice addition overall, consider this a 👍 as soon as my comment have been addressed (whether we decide to add a warning or not).

@xPaw
Copy link
Member Author

xPaw commented Jul 2, 2016

@maxpoulin64 added a message and fixed a bug along with it.

"name"
).join(",");
network.channels = _
.filter(this.channels, {type: Chan.Type.CHANNEL})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's a copy from the above, but is it possible to use:

this.channels.filter(function(channel) { return channel.type === Chan.Type.CHANNEL; });

? If so, let's do it? Please?

_.filter(this.channels, {type: Chan.Type.CHANNEL}),
"name"
).join(",");
network.channels = _
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/_/this.channels/, no? :-)

Copy link
Member Author

@xPaw xPaw Jul 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDIT: derp

log.warn("User '" + client.name + "' on network '" + args.name + "' has an invalid channel which has been ignored");
}
// `join` is kept for backwards compatibility when updating from versions <2.0
// also used by the "connect" window
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we are converting channels on the fly until a new channel is added or removed (and re-ordered, maybe?) so that the list gets dumped in the user configuration. Or are we and I'm missing it?

Depending on the answer, can we log something like [WARNING] <user> is using the deprecated comma-separated channel list.? I realize you use the same code for handling old format and the join window input though, so not trivial if it stays that way.

Copy link
Member Author

@xPaw xPaw Jul 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It gets converted when the user is loaded. And that warning isn't for comma list, it's for incorrect channel object. Comma list is silently converted below.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bottom-line is: is there a point soon where code L163 to L171 will be any obsolete?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet, it's used by the server window.

@astorije
Copy link
Member

astorije commented Jul 3, 2016

[Redacted, wrong PR...]

@dgw
Copy link
Contributor

dgw commented Jul 3, 2016

@astorije Didn't you merge #453 to fix that issue (#450)? 😄

@maxpoulin64
Copy link
Member

@dgw: no, that one just prevents joining the server window.

@xPaw
Copy link
Member Author

xPaw commented Jul 3, 2016

@maxpoulin64 I think he meant [403] Freenode No such channel, which indeed fixed that.

@dgw
Copy link
Contributor

dgw commented Jul 3, 2016

@xPaw Right, I did mean the 403 numeric.

@astorije
Copy link
Member

astorije commented Jul 3, 2016

Sorry for the noise, commented on the wrong PR...

👍 and merging this, discussion in comment can continue post-merge.

@astorije astorije merged commit 2ffcbd8 into master Jul 3, 2016
@astorije astorije deleted the xpaw/channels branch July 3, 2016 21:56
matburnham pushed a commit to matburnham/lounge that referenced this pull request Sep 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Tickets that describe a desired feature or PRs that add them to the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants