mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Handle invite in appservice roomserver consumer (#2476)
Signed-off-by: Aaron Ogle <aaron@geekgonecrazy.com>
This commit is contained in:
parent
4472267901
commit
20844942a8
1 changed files with 29 additions and 20 deletions
|
@ -83,12 +83,13 @@ func (s *OutputRoomEventConsumer) onMessage(ctx context.Context, msg *nats.Msg)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if output.Type != api.OutputTypeNewRoomEvent || output.NewRoomEvent == nil {
|
log.WithFields(log.Fields{
|
||||||
return true
|
"type": output.Type,
|
||||||
}
|
}).Debug("Got a message in OutputRoomEventConsumer")
|
||||||
|
|
||||||
|
events := []*gomatrixserverlib.HeaderedEvent{}
|
||||||
|
if output.Type == api.OutputTypeNewRoomEvent && output.NewRoomEvent != nil {
|
||||||
newEventID := output.NewRoomEvent.Event.EventID()
|
newEventID := output.NewRoomEvent.Event.EventID()
|
||||||
events := make([]*gomatrixserverlib.HeaderedEvent, 0, len(output.NewRoomEvent.AddsStateEventIDs))
|
|
||||||
events = append(events, output.NewRoomEvent.Event)
|
events = append(events, output.NewRoomEvent.Event)
|
||||||
if len(output.NewRoomEvent.AddsStateEventIDs) > 0 {
|
if len(output.NewRoomEvent.AddsStateEventIDs) > 0 {
|
||||||
eventsReq := &api.QueryEventsByIDRequest{
|
eventsReq := &api.QueryEventsByIDRequest{
|
||||||
|
@ -107,6 +108,14 @@ func (s *OutputRoomEventConsumer) onMessage(ctx context.Context, msg *nats.Msg)
|
||||||
events = append(events, eventsRes.Events...)
|
events = append(events, eventsRes.Events...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if output.Type == api.OutputTypeNewInviteEvent && output.NewInviteEvent != nil {
|
||||||
|
events = append(events, output.NewInviteEvent.Event)
|
||||||
|
} else {
|
||||||
|
log.WithFields(log.Fields{
|
||||||
|
"type": output.Type,
|
||||||
|
}).Debug("appservice OutputRoomEventConsumer ignoring event", string(msg.Data))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// Send event to any relevant application services
|
// Send event to any relevant application services
|
||||||
if err := s.filterRoomserverEvents(context.TODO(), events); err != nil {
|
if err := s.filterRoomserverEvents(context.TODO(), events); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue