Add comment, undo changes to redaction logic when getting events

This commit is contained in:
Till Faelligen 2023-03-09 09:17:09 +01:00
parent 61c67722b3
commit 422ce4f30e
No known key found for this signature in database
GPG key ID: ACCDC9606D472758

View file

@ -564,7 +564,7 @@ func (d *EventDatabase) events(
Event: event, Event: event,
}) })
} }
if redactionsArePermanent { if !redactionsArePermanent {
d.applyRedactions(results) d.applyRedactions(results)
} }
return results, nil return results, nil
@ -601,7 +601,7 @@ func (d *EventDatabase) events(
Event: event, Event: event,
}) })
} }
if redactionsArePermanent { if !redactionsArePermanent {
d.applyRedactions(results) d.applyRedactions(results)
} }
return results, nil return results, nil
@ -1022,6 +1022,8 @@ func (d *EventDatabase) MaybeRedactEvent(
return fmt.Errorf("d.RedactionsTable.MarkRedactionValidated: %w", err) 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) d.Cache.InvalidateRoomServerEvent(redactedEvent.EventNID)
return nil return nil