mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-23 06:43:09 -06:00
SendEventWithState accepts Kind argument
This commit is contained in:
parent
3a5c0922e7
commit
9c6d1eb54e
|
|
@ -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
|
// pass the event along with the state to the roomserver using a background context so we don't
|
||||||
// needlessly expire
|
// 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)
|
// lookupStateAfterEvent returns the room state after `eventID`, which is the state before eventID with the state of `eventID` (if it's a state event)
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,9 @@ func (r *FederationSenderInternalAPI) performJoinUsingServer(
|
||||||
if err = roomserverAPI.SendEventWithState(
|
if err = roomserverAPI.SendEventWithState(
|
||||||
ctx, r.rsAPI,
|
ctx, r.rsAPI,
|
||||||
&respState,
|
&respState,
|
||||||
event.Headered(respMakeJoin.RoomVersion), nil,
|
event.Headered(respMakeJoin.RoomVersion),
|
||||||
|
nil,
|
||||||
|
roomserverAPI.KindNew,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return fmt.Errorf("r.producer.SendEventWithState: %w", err)
|
return fmt.Errorf("r.producer.SendEventWithState: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,13 @@ func SendEvents(
|
||||||
return SendInputRoomEvents(ctx, rsAPI, ires)
|
return SendInputRoomEvents(ctx, rsAPI, ires)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendEventWithState writes an event with KindNew to the roomserver
|
// SendEventWithState writes an event with KindNew to the roomserver with
|
||||||
// with the state at the event as KindOutlier before it. Will not send any event that is
|
// the state at the event before it. The state events will be sent to the
|
||||||
// marked as `true` in haveEventIDs
|
// roomserver as the given "stateKind", e.g. new, outlier. Will not send
|
||||||
|
// any event that is marked as `true` in haveEventIDs
|
||||||
func SendEventWithState(
|
func SendEventWithState(
|
||||||
ctx context.Context, rsAPI RoomserverInternalAPI, state *gomatrixserverlib.RespState,
|
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 {
|
) error {
|
||||||
outliers, err := state.Events()
|
outliers, err := state.Events()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -58,7 +59,7 @@ func SendEventWithState(
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ires = append(ires, InputRoomEvent{
|
ires = append(ires, InputRoomEvent{
|
||||||
Kind: KindOutlier,
|
Kind: stateKind,
|
||||||
Event: outlier.Headered(event.RoomVersion),
|
Event: outlier.Headered(event.RoomVersion),
|
||||||
AuthEventIDs: outlier.AuthEventIDs(),
|
AuthEventIDs: outlier.AuthEventIDs(),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue