mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 12:06:08 -04:00
Implement event format v2
This commit is contained in:
parent
cc2d650ef7
commit
84af577356
4 changed files with 110 additions and 21 deletions
|
@ -267,6 +267,7 @@ def serialize_event(e, time_now_ms, as_client_event=True,
|
|||
Returns:
|
||||
dict
|
||||
"""
|
||||
|
||||
# FIXME(erikj): To handle the case of presence events and the like
|
||||
if not isinstance(e, EventBase):
|
||||
return e
|
||||
|
@ -276,6 +277,8 @@ def serialize_event(e, time_now_ms, as_client_event=True,
|
|||
# Should this strip out None's?
|
||||
d = {k: v for k, v in e.get_dict().items()}
|
||||
|
||||
d["event_id"] = e.event_id
|
||||
|
||||
if "age_ts" in d["unsigned"]:
|
||||
d["unsigned"]["age"] = time_now_ms - d["unsigned"]["age_ts"]
|
||||
del d["unsigned"]["age_ts"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue