Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Output type redacted event #3445

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions appservice/consumers/roomserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (s *OutputRoomEventConsumer) onMessage(
for _, msg := range msgs {
// Only handle events we care about
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
}
// Parse out the event JSON
Expand Down Expand Up @@ -147,7 +147,11 @@ func (s *OutputRoomEventConsumer) onMessage(
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:
continue
}
Expand Down
5 changes: 5 additions & 0 deletions syncapi/consumers/roomserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ func (s *OutputRoomEventConsumer) onMessage(ctx context.Context, msgs []*nats.Ms
s.onRetirePeek(s.ctx, *output.RetirePeek)
case api.OutputTypeRedactedEvent:
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:
err = s.onPurgeRoom(s.ctx, *output.PurgeRoom)
if err != nil {
Expand Down
Loading