diff options
author | Mark Haines <mark.haines@matrix.org> | 2015-01-26 16:32:40 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2015-01-26 16:32:40 +0000 |
commit | 3186c5bdbc49cf7cbca3ae0b45bc8657b069a9a8 (patch) | |
tree | dd7ba7aeb2be210a86668a7dc675627b17ec721e /synapse/events/utils.py | |
parent | Add handler for /sync API (diff) | |
parent | Merge pull request #34 from matrix-org/remove_serialize_event_from_hs (diff) | |
download | synapse-3186c5bdbc49cf7cbca3ae0b45bc8657b069a9a8.tar.xz |
Merge branch 'develop' into client_v2_sync
Diffstat (limited to 'synapse/events/utils.py')
-rw-r--r-- | synapse/events/utils.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/synapse/events/utils.py b/synapse/events/utils.py index bcb5457278..e391aca4cc 100644 --- a/synapse/events/utils.py +++ b/synapse/events/utils.py @@ -89,31 +89,31 @@ def prune_event(event): return type(event)(allowed_fields) -def serialize_event(hs, e, client_event=True): +def serialize_event(e, time_now_ms, client_event=True): # FIXME(erikj): To handle the case of presence events and the like if not isinstance(e, EventBase): return e + time_now_ms = int(time_now_ms) + # Should this strip out None's? d = {k: v for k, v in e.get_dict().items()} if not client_event: # set the age and keep all other keys if "age_ts" in d["unsigned"]: - now = int(hs.get_clock().time_msec()) - d["unsigned"]["age"] = now - d["unsigned"]["age_ts"] + d["unsigned"]["age"] = time_now_ms - d["unsigned"]["age_ts"] return d if "age_ts" in d["unsigned"]: - now = int(hs.get_clock().time_msec()) - d["age"] = now - d["unsigned"]["age_ts"] + d["age"] = time_now_ms - d["unsigned"]["age_ts"] del d["unsigned"]["age_ts"] d["user_id"] = d.pop("sender", None) if "redacted_because" in e.unsigned: d["redacted_because"] = serialize_event( - hs, e.unsigned["redacted_because"] + e.unsigned["redacted_because"], time_now_ms ) del d["unsigned"]["redacted_because"] |