This commit is contained in:
Richard Carback 2025-08-15 15:40:10 +02:00 committed by GitHub
commit ec943053eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View file

@ -111,7 +111,7 @@ func (s *OutputRoomEventConsumer) onMessage(
for _, msg := range msgs { for _, msg := range msgs {
// Only handle events we care about // Only handle events we care about
receivedType := api.OutputType(msg.Header.Get(jetstream.RoomEventType)) receivedType := api.OutputType(msg.Header.Get(jetstream.RoomEventType))
if receivedType != api.OutputTypeNewRoomEvent && receivedType != api.OutputTypeNewInviteEvent { if receivedType != api.OutputTypeNewRoomEvent && receivedType != api.OutputTypeNewInviteEvent && receivedType != api.OutputTypeRedactedEvent {
continue continue
} }
// Parse out the event JSON // Parse out the event JSON
@ -147,7 +147,11 @@ func (s *OutputRoomEventConsumer) onMessage(
events = append(events, eventsRes.Events...) events = append(events, eventsRes.Events...)
} }
} }
case api.OutputTypeRedactedEvent:
if output.RedactedEvent == nil || !s.appserviceIsInterestedInEvent(ctx, output.RedactedEvent.RedactedBecause, state.ApplicationService) {
continue
}
events = append(events, output.RedactedEvent.RedactedBecause)
default: default:
continue continue
} }

View file

@ -132,6 +132,11 @@ func (s *OutputRoomEventConsumer) onMessage(ctx context.Context, msgs []*nats.Ms
s.onRetirePeek(s.ctx, *output.RetirePeek) s.onRetirePeek(s.ctx, *output.RetirePeek)
case api.OutputTypeRedactedEvent: case api.OutputTypeRedactedEvent:
err = s.onRedactEvent(s.ctx, *output.RedactedEvent) err = s.onRedactEvent(s.ctx, *output.RedactedEvent)
if err == nil && s.asProducer != nil {
if err = s.asProducer.ProduceRoomEvents(msg); err != nil {
log.WithError(err).Warn("failed to produce OutputAppserviceEvent")
}
}
case api.OutputTypePurgeRoom: case api.OutputTypePurgeRoom:
err = s.onPurgeRoom(s.ctx, *output.PurgeRoom) err = s.onPurgeRoom(s.ctx, *output.PurgeRoom)
if err != nil { if err != nil {