mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-07-28 14:14:07 -04:00
Include hashes of previous pdus when referencing them
This commit is contained in:
parent
66104da10c
commit
bb04447c44
11 changed files with 95 additions and 31 deletions
|
@ -45,9 +45,7 @@ class PduCodec(object):
|
|||
kwargs["event_id"] = encode_event_id(pdu.pdu_id, pdu.origin)
|
||||
kwargs["room_id"] = pdu.context
|
||||
kwargs["etype"] = pdu.pdu_type
|
||||
kwargs["prev_events"] = [
|
||||
encode_event_id(p[0], p[1]) for p in pdu.prev_pdus
|
||||
]
|
||||
kwargs["prev_pdus"] = pdu.prev_pdus
|
||||
|
||||
if hasattr(pdu, "prev_state_id") and hasattr(pdu, "prev_state_origin"):
|
||||
kwargs["prev_state"] = encode_event_id(
|
||||
|
@ -78,11 +76,8 @@ class PduCodec(object):
|
|||
d["context"] = event.room_id
|
||||
d["pdu_type"] = event.type
|
||||
|
||||
if hasattr(event, "prev_events"):
|
||||
d["prev_pdus"] = [
|
||||
decode_event_id(e, self.server_name)
|
||||
for e in event.prev_events
|
||||
]
|
||||
if hasattr(event, "prev_pdus"):
|
||||
d["prev_pdus"] = event.prev_pdus
|
||||
|
||||
if hasattr(event, "prev_state"):
|
||||
d["prev_state_id"], d["prev_state_origin"] = (
|
||||
|
@ -95,7 +90,7 @@ class PduCodec(object):
|
|||
kwargs = copy.deepcopy(event.unrecognized_keys)
|
||||
kwargs.update({
|
||||
k: v for k, v in d.items()
|
||||
if k not in ["event_id", "room_id", "type", "prev_events"]
|
||||
if k not in ["event_id", "room_id", "type"]
|
||||
})
|
||||
|
||||
if "ts" not in kwargs:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue