diff options
author | Erik Johnston <erik@matrix.org> | 2015-01-30 11:10:37 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-01-30 11:10:37 +0000 |
commit | 2ebf795c0ada8b30f22f9aca54753471a04649f6 (patch) | |
tree | 23710ca7b15e7d65eee8885a04b23a829ca00379 /synapse/events/utils.py | |
parent | Update the current state of an event if we update auth events. (diff) | |
parent | Include content in notification pokes (diff) | |
download | synapse-2ebf795c0ada8b30f22f9aca54753471a04649f6.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into rejections
Conflicts: synapse/storage/__init__.py synapse/storage/schema/delta/v12.sql
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 08d6d6fa47..7ae5d42b96 100644 --- a/synapse/events/utils.py +++ b/synapse/events/utils.py @@ -94,31 +94,31 @@ def prune_event(event): ) -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"] |