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

Invites are not always correctly handled over federation #350

Closed
kegsay opened this issue Oct 19, 2023 · 0 comments · Fixed by #351
Closed

Invites are not always correctly handled over federation #350

kegsay opened this issue Oct 19, 2023 · 0 comments · Fixed by #351
Labels
bug Something isn't working poller

Comments

@kegsay
Copy link
Member

kegsay commented Oct 19, 2023

When a user joins a room they were invited to over federation, the join event can lack an unsigned.prev_content.membership == "invite". Instead, the prev_content is missing entirely. @DMRobertson and I theorise this is because the receiving server could not get the replaces_state event, because that would require a backfill.

Unfortunately, up until #333 the proxy was relying on this field being set. If it was unset, the invite would never be removed from the invites table.

When a client who is joined-but-still-has-the-invite requests information about this room, they end up with a blend of joined/invited data. Specifically, the invite_state is set to the stripped invite state events from the invite. This is bad because the presence of invite_state tells clients that the user is invited and not joined to the room. This could cause them to insert the room into a different place in the UI, or remove it entirely from the room list.

The fix in #333 means we no longer rely on this field, but there are still rooms which may be in this state in the database. We need to write a migration which:

  • For each invite in the invites table (which shouldn't be too big relative to the number of joined rooms)
    • Is this user present in the current state of the room? NO: ignore (the proxy isn't in this room yet) YES:
    • Is the membership value invite? YES: ignore (someone else joined the room and the membership value is from their poller). NO:
    • Remove the invite from the invites table, as their current membership is something other than invite.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working poller
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant