Invites v2 endpoint (#952)
* Start converting v1 invite endpoint to v2 * Update gomatrixserverlib * Early federationsender code for sending invites * Sending invites sorta happens now * Populate invite request with stripped state * Remodel a bit, don't reflect received invites * Handle invite_room_state * Handle room versions a bit better * Update gomatrixserverlib * Tweak order in destinationQueue.next * Revert check in processMessage * Tweak federation sender destination queue code a bit * Add comments
This commit is contained in:
parent
955244c092
commit
067b875063
18 changed files with 286 additions and 95 deletions
|
|
@ -112,7 +112,7 @@ func updateMembership(
|
|||
|
||||
switch newMembership {
|
||||
case gomatrixserverlib.Invite:
|
||||
return updateToInviteMembership(mu, add, updates)
|
||||
return updateToInviteMembership(mu, add, updates, updater.RoomVersion())
|
||||
case gomatrixserverlib.Join:
|
||||
return updateToJoinMembership(mu, add, updates)
|
||||
case gomatrixserverlib.Leave, gomatrixserverlib.Ban:
|
||||
|
|
@ -126,6 +126,7 @@ func updateMembership(
|
|||
|
||||
func updateToInviteMembership(
|
||||
mu types.MembershipUpdater, add *gomatrixserverlib.Event, updates []api.OutputEvent,
|
||||
roomVersion gomatrixserverlib.RoomVersion,
|
||||
) ([]api.OutputEvent, error) {
|
||||
// We may have already sent the invite to the user, either because we are
|
||||
// reprocessing this event, or because the we received this invite from a
|
||||
|
|
@ -136,14 +137,14 @@ func updateToInviteMembership(
|
|||
return nil, err
|
||||
}
|
||||
if needsSending {
|
||||
roomVersion := gomatrixserverlib.RoomVersionV1
|
||||
// We notify the consumers using a special event even though we will
|
||||
// notify them about the change in current state as part of the normal
|
||||
// room event stream. This ensures that the consumers only have to
|
||||
// consider a single stream of events when determining whether a user
|
||||
// is invited, rather than having to combine multiple streams themselves.
|
||||
onie := api.OutputNewInviteEvent{
|
||||
Event: (*add).Headered(roomVersion),
|
||||
Event: (*add).Headered(roomVersion),
|
||||
RoomVersion: roomVersion,
|
||||
}
|
||||
updates = append(updates, api.OutputEvent{
|
||||
Type: api.OutputTypeNewInviteEvent,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue