diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-03-07 17:17:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-07 17:17:16 +0000 |
commit | 67de4dbd0c729fe9c672081f4f4ab64f03efeb36 (patch) | |
tree | a27394ad11c7ecce03014892116673870de74d4b /appservice | |
parent | 05fa66c9c87c1ad32ab3d1554f53475ed1f40707 (diff) |
Don't send `adds_state_events` in roomserver output events anymore (#2258)
* Don't send `adds_state_events` in roomserver output events anymore
* Set `omitempty` on some output fields that aren't always set
* Add `AddsState` helper function
* No-op if no added state event IDs
* Revert "No-op if no added state event IDs"
This reverts commit 71a0ef3df10e0d94234d916246c30b0a4e82b26e.
* Revert "Add `AddsState` helper function"
This reverts commit c9fbe45475eb12ae44d2a8da7c0fc3a002ad9819.
Diffstat (limited to 'appservice')
-rw-r--r-- | appservice/consumers/roomserver.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/appservice/consumers/roomserver.go b/appservice/consumers/roomserver.go index 7b59e370..9d723bed 100644 --- a/appservice/consumers/roomserver.go +++ b/appservice/consumers/roomserver.go @@ -88,7 +88,16 @@ func (s *OutputRoomEventConsumer) onMessage(ctx context.Context, msg *nats.Msg) } events := []*gomatrixserverlib.HeaderedEvent{output.NewRoomEvent.Event} - events = append(events, output.NewRoomEvent.AddStateEvents...) + if len(output.NewRoomEvent.AddsStateEventIDs) > 0 { + eventsReq := &api.QueryEventsByIDRequest{ + EventIDs: output.NewRoomEvent.AddsStateEventIDs, + } + eventsRes := &api.QueryEventsByIDResponse{} + if err := s.rsAPI.QueryEventsByID(s.ctx, eventsReq, eventsRes); err != nil { + return false + } + events = append(events, eventsRes.Events...) + } // Send event to any relevant application services if err := s.filterRoomserverEvents(context.TODO(), events); err != nil { |