0
0
Fork 0
mirror of https://github.com/matrix-org/dendrite synced 2024-12-14 20:03:52 +01:00

No-op if no added state event IDs

This commit is contained in:
Neil Alexander 2022-03-07 16:38:24 +00:00
parent c9fbe45475
commit 71a0ef3df1
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -170,6 +170,7 @@ type OutputNewRoomEvent struct {
// The slice returned contains the output room event itself in all cases. // The slice returned contains the output room event itself in all cases.
func (o *OutputNewRoomEvent) AddsState(ctx context.Context, rsAPI RoomserverInternalAPI) ([]*gomatrixserverlib.HeaderedEvent, error) { func (o *OutputNewRoomEvent) AddsState(ctx context.Context, rsAPI RoomserverInternalAPI) ([]*gomatrixserverlib.HeaderedEvent, error) {
events := make([]*gomatrixserverlib.HeaderedEvent, 0, len(o.AddsStateEventIDs)) events := make([]*gomatrixserverlib.HeaderedEvent, 0, len(o.AddsStateEventIDs))
if len(o.AddsStateEventIDs) > 0 {
eventsReq := &QueryEventsByIDRequest{ eventsReq := &QueryEventsByIDRequest{
EventIDs: o.AddsStateEventIDs, EventIDs: o.AddsStateEventIDs,
} }
@ -178,6 +179,7 @@ func (o *OutputNewRoomEvent) AddsState(ctx context.Context, rsAPI RoomserverInte
return nil, fmt.Errorf("s.rsAPI.QueryEventsByID: %w", err) return nil, fmt.Errorf("s.rsAPI.QueryEventsByID: %w", err)
} }
events = append(events, eventsRes.Events...) events = append(events, eventsRes.Events...)
}
return events, nil return events, nil
} }