From 422ce4f30ecfacc47ee9afcc52a8ac98c934a6b1 Mon Sep 17 00:00:00 2001 From: Till Faelligen <2353100+S7evinK@users.noreply.github.com> Date: Thu, 9 Mar 2023 09:17:09 +0100 Subject: [PATCH] Add comment, undo changes to redaction logic when getting events --- roomserver/storage/shared/storage.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/roomserver/storage/shared/storage.go b/roomserver/storage/shared/storage.go index 0cf598ef0..78bda95e5 100644 --- a/roomserver/storage/shared/storage.go +++ b/roomserver/storage/shared/storage.go @@ -564,7 +564,7 @@ func (d *EventDatabase) events( Event: event, }) } - if redactionsArePermanent { + if !redactionsArePermanent { d.applyRedactions(results) } return results, nil @@ -601,7 +601,7 @@ func (d *EventDatabase) events( Event: event, }) } - if redactionsArePermanent { + if !redactionsArePermanent { d.applyRedactions(results) } return results, nil @@ -1022,6 +1022,8 @@ func (d *EventDatabase) MaybeRedactEvent( return fmt.Errorf("d.RedactionsTable.MarkRedactionValidated: %w", err) } + // We remove the entry from the cache, as if we just "StoreRoomServerEvent", we can't be + // certain that the cached entry actually is updated, since ristretto is eventual-persistent. d.Cache.InvalidateRoomServerEvent(redactedEvent.EventNID) return nil