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

Fix load of channels from user config #4710

Merged
merged 1 commit into from Apr 8, 2023

Conversation

progval
Copy link
Contributor

@progval progval commented Mar 14, 2023

Network.export() only writes the "type" key if it's a ChanType.QUERY; so the config on disk has no "type":

if (chan.type === ChanType.CHANNEL) {
keys.push("key");
} else if (chan.type === ChanType.QUERY) {
keys.push("type");
}
return _.pick(chan, keys);

This causes it to be undefined when loading, which breaks various other checks, and then drops it the next time the config is saved:

.filter(function (channel) {
return channel.type === ChanType.CHANNEL || channel.type === ChanType.QUERY;
})

@xPaw
Copy link
Member

xPaw commented Mar 14, 2023

Can you add test coverage for this?

@progval
Copy link
Contributor Author

progval commented Mar 14, 2023

I don't think I can do that without refactoring; it's in a the function that instantiates irc-framework

@xPaw
Copy link
Member

xPaw commented Mar 14, 2023

Mhm yeah. I'm trying to think how this worked (before?) and when did it break.

@progval progval marked this pull request as draft March 14, 2023 19:38
@progval
Copy link
Contributor Author

progval commented Mar 14, 2023

I just opened a PR with said refactoring: #4711

And merged #4711 into this PR along with a new test so you can see what it looks like.

@xPaw xPaw added the Type: Bug Issues that report and PRs that solve any defects that cause unexpected behaviors. label Mar 14, 2023
@progval progval marked this pull request as ready for review March 17, 2023 13:51
@brunnre8
Copy link
Member

brunnre8 commented Apr 8, 2023

Can you squash down the fixes? Then I'll merge it.
I'd do it on my own, but then GH is too stupid to let me "merge" it via some other commit and you'd loose the attribution here.

Network.export() only writes the "type" key if it's a ChanType.QUERY;
so the config on disk has no "type".

This causes it to be undefined when loading, which breaks various other
checks, and then drops it the next time the config is saved.
@progval
Copy link
Contributor Author

progval commented Apr 8, 2023

done

@brunnre8 brunnre8 merged commit 90ad06a into thelounge:master Apr 8, 2023
5 checks passed
@brunnre8
Copy link
Member

brunnre8 commented Apr 8, 2023

Thank you val

@MaxLeiter MaxLeiter added this to the 4.4.0 milestone Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issues that report and PRs that solve any defects that cause unexpected behaviors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants