mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-05-19 14:20:21 -04:00
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).
This commit is contained in:
parent
3e4af36bc8
commit
88cd6f9378
8 changed files with 119 additions and 80 deletions
|
@ -1619,9 +1619,12 @@ class PersistEventsStore:
|
|||
|
||||
txn.call_after(prefill)
|
||||
|
||||
def _store_redaction(self, txn, event):
|
||||
# invalidate the cache for the redacted event
|
||||
def _store_redaction(self, txn: LoggingTransaction, event: EventBase) -> None:
|
||||
# Invalidate the caches for the redacted event, note that these caches
|
||||
# are also cleared as part of event replication in _invalidate_caches_for_event.
|
||||
txn.call_after(self.store._invalidate_get_event_cache, event.redacts)
|
||||
txn.call_after(self.store.get_relations_for_event.invalidate, (event.redacts,))
|
||||
txn.call_after(self.store.get_applicable_edit.invalidate, (event.redacts,))
|
||||
|
||||
self.db_pool.simple_upsert_txn(
|
||||
txn,
|
||||
|
@ -1812,9 +1815,7 @@ class PersistEventsStore:
|
|||
txn.call_after(self.store.get_applicable_edit.invalidate, (parent_id,))
|
||||
|
||||
if rel_type == RelationTypes.THREAD:
|
||||
txn.call_after(
|
||||
self.store.get_thread_summary.invalidate, (parent_id, event.room_id)
|
||||
)
|
||||
txn.call_after(self.store.get_thread_summary.invalidate, (parent_id,))
|
||||
# It should be safe to only invalidate the cache if the user has not
|
||||
# previously participated in the thread, but that's difficult (and
|
||||
# potentially error-prone) so it is always invalidated.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue