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

Calling PUT /_matrix/federation/v1/invite/{roomId}/{eventId} on a remote homeserver is redundant if they're already in the room #2062

Open
anoadragon453 opened this issue Jan 24, 2025 · 1 comment
Labels
improvement An idea/future MSC for the spec

Comments

@anoadragon453
Copy link
Member

anoadragon453 commented Jan 24, 2025

PUT /_matrix/federation/v1/invite/{roomId}/{eventId} is useful, and its own endpoint, as homeservers that aren't yet participating in a room need to be directly notified when one of their users has been invited.

However, if a homeserver is already participating in a room, when one of their user is invited they'll receive both:

Both of these tell the homeserver the same thing - and in practice developers tend to only implement event handling based on one of these. Typically /invite.

This also created subtle implementation bugs such as element-hq/synapse#18075 in Synapse - where Synapse notifies clients that they've been invited based on /invite - but doesn't actually consider the user invited until the corresponding m.room.member event comes in. If the user tries to join the room in this gap - they'll get an error that they haven't been invited.

It's also just unnecessary work - we don't need to notify a remote homeserver about an invite twice.

(credit to @MadLittleMods for originally pointing this out in the Synapse PR linked about.)

@richvdh
Copy link
Member

richvdh commented Jan 24, 2025

IIRC, invite events are supposed to be signed by the invited homeserver, before they are sent out over PUT /_matrix/federation/v1/send/{txnId}. /v1/invite allows the target homeserver to return that signature.

You could argue that sending it again over PUT /_matrix/federation/v1/send/{txnId} to the target HS is redundant, but special-casing it is more work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement An idea/future MSC for the spec
Projects
None yet
Development

No branches or pull requests

2 participants