mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-12-10 13:02:46 -05:00
Make 'event.redacts' never raise. (#6771)
There are quite a few places that we assume that a redaction event has a corresponding `redacts` key, which is not always the case. So lets cheekily make it so that event.redacts just returns None instead.
This commit is contained in:
parent
51fc3f693e
commit
fa4d609e20
5 changed files with 62 additions and 6 deletions
|
|
@ -951,7 +951,7 @@ class EventsStore(
|
|||
elif event.type == EventTypes.Message:
|
||||
# Insert into the event_search table.
|
||||
self._store_room_message_txn(txn, event)
|
||||
elif event.type == EventTypes.Redaction:
|
||||
elif event.type == EventTypes.Redaction and event.redacts is not None:
|
||||
# Insert into the redactions table.
|
||||
self._store_redaction(txn, event)
|
||||
elif event.type == EventTypes.Retention:
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ class EventsWorkerStore(SQLBaseStore):
|
|||
# we have to recheck auth now.
|
||||
|
||||
if not allow_rejected and entry.event.type == EventTypes.Redaction:
|
||||
if not hasattr(entry.event, "redacts"):
|
||||
if entry.event.redacts is None:
|
||||
# A redacted redaction doesn't have a `redacts` key, in
|
||||
# which case lets just withhold the event.
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue