-
Notifications
You must be signed in to change notification settings - Fork 30
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 chanlist in nick change events #117
Conversation
This reverts commit 955f6d4. Fix matrix-org/matrix-appservice-irc#1776
We know that nickChannel.users.get() always returns a value, because we check it via .has() beforehand.
Signed-off-by: jkhsjdhjs <[email protected]>
a439c8b
to
7fefffe
Compare
@tadzik friendly ping |
Having tested it against the IRC bridge, it doesn't seem to solve the issue – both with and without the patch the event fires in https://github.com/matrix-org/matrix-appservice-irc/blob/develop/src/irc/BridgedClient.ts#L294. It then never does anything because Did it fix anything in your case? Is there any situation when this should fire but doesn't? Could you share steps to reproduce this? |
That's a different event I think, can't tell exactly because I no longer have access to my dev instance, but I think this is the event that isn't triggered currently: https://github.com/matrix-org/matrix-appservice-irc/blob/7edfec7bd45cf3695904be7da3633d2e4475f90c/src/irc/IrcEventBroker.ts#L399 Or to be precise: The event handler is triggered, the To reproduce you can just have an irc user (not a puppet) change their nick. The corresponding matrix puppet will not be updated. #103 attempted to fix this previously and initially had it correct, but then committed this to fix the typecheckers complaints: 955f6d4 This commit, however, doesn't make any sense and actually breaks the state tracking, as it saves booleans instead of channel lists in the |
@@ -630,9 +630,8 @@ export class Client extends (EventEmitter as unknown as new () => TypedEmitter<C | |||
|
|||
// finding what channels a user is in | |||
this.state.chans.forEach((nickChannel, channame) => { | |||
const chanUser = message.nick && nickChannel.users.get(message.nick); | |||
if (message.nick && chanUser) { |
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.
This if-statement checks if chanUser
is truthy, and an empty string is not.
So nick change events don't get past this check, if the user has no channel modes set (normal user).
The event still fires in matrix-appservice-irc, but with a channel list that's always empty, so nothing happens.
I was able to reproduce nick changes not getting bridged properly, and this PR correctly fixes the issue by checking if the old nick was in the userlist for the channel, instead of relying on the stored usermode string being truthy (an empty string isn't). |
manual cherry-pick fix from PR matrix-org#117 by jkhsjdhjs on upstream github
Okay; gave it a fresh try and experimented a bit, since it was clearly something wrong with me here :) Turns out that for this to work, |
This fixes nick changes not being bridged to matrix, due to the chanlist being empty in nick change events.
Fix matrix-org/matrix-appservice-irc#1776