summary refs log tree commit diff
path: root/synapse/storage/databases/main/cache.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2022-03-10 09:03:59 -0500
committerGitHub <noreply@github.com>2022-03-10 09:03:59 -0500
commit88cd6f937807e64c05458cec86ef0ba0c1c656b3 (patch)
tree77f4169a65b320c0ca9fbf8319c7d3ae0a655685 /synapse/storage/databases/main/cache.py
parentRename get_tcp_replication to get_replication_command_handler. (#12192) (diff)
downloadsynapse-88cd6f937807e64c05458cec86ef0ba0c1c656b3.tar.xz
Allow retrieving the relations of a redacted event. (#12130)
This is allowed per MSC2675, although the original implementation did
not allow for it and would return an empty chunk / not bundle aggregations.

The main thing to improve is that the various caches get cleared properly
when an event is redacted, and that edits must not leak if the original
event is redacted (as that would presumably leak something similar to
the original event content).
Diffstat (limited to 'synapse/storage/databases/main/cache.py')
-rw-r--r--synapse/storage/databases/main/cache.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/storage/databases/main/cache.py b/synapse/storage/databases/main/cache.py
index abd54c7dc7..d6a2df1afe 100644
--- a/synapse/storage/databases/main/cache.py
+++ b/synapse/storage/databases/main/cache.py
@@ -191,6 +191,10 @@ class CacheInvalidationWorkerStore(SQLBaseStore):
 
         if redacts:
             self._invalidate_get_event_cache(redacts)
+            # Caches which might leak edits must be invalidated for the event being
+            # redacted.
+            self.get_relations_for_event.invalidate((redacts,))
+            self.get_applicable_edit.invalidate((redacts,))
 
         if etype == EventTypes.Member:
             self._membership_stream_cache.entity_has_changed(state_key, stream_ordering)