mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-22 06:13:10 -06:00
Make PerformJoin send input membership event
This commit is contained in:
parent
e7d450adb8
commit
8fa3002f88
|
|
@ -118,23 +118,6 @@ func SendInvite(
|
||||||
return response.Error
|
return response.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now send the invite event into the roomserver. If the room is known
|
|
||||||
// locally then this will succeed, notifying existing users in the room
|
|
||||||
// about the new invite. If the room isn't known locally then this will
|
|
||||||
// fail - and that's also OK.
|
|
||||||
inputReq := &InputRoomEventsRequest{
|
|
||||||
InputRoomEvents: []InputRoomEvent{
|
|
||||||
{
|
|
||||||
Kind: KindNew,
|
|
||||||
Event: inviteEvent,
|
|
||||||
AuthEventIDs: inviteEvent.AuthEventIDs(),
|
|
||||||
SendAsServer: string(sendAsServer),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
inputRes := &InputRoomEventsResponse{}
|
|
||||||
_ = rsAPI.InputRoomEvents(ctx, inputReq, inputRes)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,15 +143,22 @@ func (r *RoomserverInternalAPI) PerformInvite(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unwrapped := event.Unwrap()
|
// Send the invite event to the roomserver input stream. This will
|
||||||
outputUpdates, err := updateToInviteMembership(updater, &unwrapped, nil, req.Event.RoomVersion)
|
// notify existing users in the room about the invite, update the
|
||||||
if err != nil {
|
// membership table and ensure that the event is ready and available
|
||||||
return fmt.Errorf("updateToInviteMembership: %w", err)
|
// to use as an auth event when accepting the invite.
|
||||||
}
|
inputReq := &api.InputRoomEventsRequest{
|
||||||
|
InputRoomEvents: []api.InputRoomEvent{
|
||||||
if err = r.WriteOutputEvents(roomID, outputUpdates); err != nil {
|
{
|
||||||
return fmt.Errorf("r.WriteOutputEvents: %w", err)
|
Kind: api.KindNew,
|
||||||
|
Event: event,
|
||||||
|
AuthEventIDs: event.AuthEventIDs(),
|
||||||
|
SendAsServer: string(r.Cfg.Matrix.ServerName),
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
inputRes := &api.InputRoomEventsResponse{}
|
||||||
|
_ = r.InputRoomEvents(ctx, inputReq, inputRes)
|
||||||
|
|
||||||
succeeded = true
|
succeeded = true
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue