mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-30 04:52:46 +00:00
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
|
@ -104,18 +104,14 @@ func (c *RoomserverProducer) SendInputRoomEvents(
|
|||
// This should only be needed for invite events that occur outside of a known room.
|
||||
// If we are in the room then the event should be sent using the SendEvents method.
|
||||
func (c *RoomserverProducer) SendInvite(
|
||||
ctx context.Context, inviteEvent gomatrixserverlib.Event,
|
||||
ctx context.Context, inviteEvent gomatrixserverlib.HeaderedEvent,
|
||||
inviteRoomState []gomatrixserverlib.InviteV2StrippedState,
|
||||
) error {
|
||||
verReq := api.QueryRoomVersionForRoomRequest{RoomID: inviteEvent.RoomID()}
|
||||
verRes := api.QueryRoomVersionForRoomResponse{}
|
||||
err := c.QueryAPI.QueryRoomVersionForRoom(ctx, &verReq, &verRes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
request := api.InputRoomEventsRequest{
|
||||
InputInviteEvents: []api.InputInviteEvent{{
|
||||
Event: inviteEvent.Headered(verRes.RoomVersion),
|
||||
Event: inviteEvent,
|
||||
InviteRoomState: inviteRoomState,
|
||||
RoomVersion: inviteEvent.RoomVersion,
|
||||
}},
|
||||
}
|
||||
var response api.InputRoomEventsResponse
|
||||
|
|
|
@ -260,6 +260,9 @@ func (r joinRoomReq) joinRoomUsingServers(
|
|||
}{roomID},
|
||||
}
|
||||
}
|
||||
// TODO: This needs to be re-thought, as in the case of an invite, the room
|
||||
// will exist in the database in roomserver_rooms but won't have any state
|
||||
// events, therefore this below check fails.
|
||||
if err != common.ErrRoomNoExists {
|
||||
util.GetLogger(r.req.Context()).WithError(err).Error("common.BuildEvent failed")
|
||||
return jsonerror.InternalServerError()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue