mirror of
https://github.com/matrix-org/dendrite
synced 2024-11-10 15:14:36 +00:00
No-op if no added state event IDs
This commit is contained in:
parent
c9fbe45475
commit
71a0ef3df1
1 changed files with 9 additions and 7 deletions
|
@ -170,14 +170,16 @@ 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))
|
||||||
eventsReq := &QueryEventsByIDRequest{
|
if len(o.AddsStateEventIDs) > 0 {
|
||||||
EventIDs: o.AddsStateEventIDs,
|
eventsReq := &QueryEventsByIDRequest{
|
||||||
|
EventIDs: o.AddsStateEventIDs,
|
||||||
|
}
|
||||||
|
eventsRes := &QueryEventsByIDResponse{}
|
||||||
|
if err := rsAPI.QueryEventsByID(ctx, eventsReq, eventsRes); err != nil {
|
||||||
|
return nil, fmt.Errorf("s.rsAPI.QueryEventsByID: %w", err)
|
||||||
|
}
|
||||||
|
events = append(events, eventsRes.Events...)
|
||||||
}
|
}
|
||||||
eventsRes := &QueryEventsByIDResponse{}
|
|
||||||
if err := rsAPI.QueryEventsByID(ctx, eventsReq, eventsRes); err != nil {
|
|
||||||
return nil, fmt.Errorf("s.rsAPI.QueryEventsByID: %w", err)
|
|
||||||
}
|
|
||||||
events = append(events, eventsRes.Events...)
|
|
||||||
return events, nil
|
return events, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue