diff --git a/federationapi/routing/send.go b/federationapi/routing/send.go index cad779219..bbd11fc39 100644 --- a/federationapi/routing/send.go +++ b/federationapi/routing/send.go @@ -457,7 +457,7 @@ func (t *txnReq) processEventWithMissingState(e gomatrixserverlib.Event, roomVer // pass the event along with the state to the roomserver using a background context so we don't // needlessly expire - return api.SendEventWithState(context.Background(), t.rsAPI, resolvedState, e.Headered(roomVersion), t.haveEventIDs()) + return api.SendEventWithState(context.Background(), t.rsAPI, resolvedState, e.Headered(roomVersion), t.haveEventIDs(), api.KindOutlier) } // lookupStateAfterEvent returns the room state after `eventID`, which is the state before eventID with the state of `eventID` (if it's a state event) diff --git a/federationsender/internal/perform.go b/federationsender/internal/perform.go index da8d41a74..e099298ce 100644 --- a/federationsender/internal/perform.go +++ b/federationsender/internal/perform.go @@ -198,7 +198,9 @@ func (r *FederationSenderInternalAPI) performJoinUsingServer( if err = roomserverAPI.SendEventWithState( ctx, r.rsAPI, &respState, - event.Headered(respMakeJoin.RoomVersion), nil, + event.Headered(respMakeJoin.RoomVersion), + nil, + roomserverAPI.KindNew, ); err != nil { return fmt.Errorf("r.producer.SendEventWithState: %w", err) } diff --git a/roomserver/api/wrapper.go b/roomserver/api/wrapper.go index 207c12c8f..1d2b07869 100644 --- a/roomserver/api/wrapper.go +++ b/roomserver/api/wrapper.go @@ -40,12 +40,13 @@ func SendEvents( return SendInputRoomEvents(ctx, rsAPI, ires) } -// SendEventWithState writes an event with KindNew to the roomserver -// with the state at the event as KindOutlier before it. Will not send any event that is -// marked as `true` in haveEventIDs +// SendEventWithState writes an event with KindNew to the roomserver with +// the state at the event before it. The state events will be sent to the +// roomserver as the given "stateKind", e.g. new, outlier. Will not send +// any event that is marked as `true` in haveEventIDs func SendEventWithState( ctx context.Context, rsAPI RoomserverInternalAPI, state *gomatrixserverlib.RespState, - event gomatrixserverlib.HeaderedEvent, haveEventIDs map[string]bool, + event gomatrixserverlib.HeaderedEvent, haveEventIDs map[string]bool, stateKind Kind, ) error { outliers, err := state.Events() if err != nil { @@ -58,7 +59,7 @@ func SendEventWithState( continue } ires = append(ires, InputRoomEvent{ - Kind: KindOutlier, + Kind: stateKind, Event: outlier.Headered(event.RoomVersion), AuthEventIDs: outlier.AuthEventIDs(), })