Insert 'age' into top level when returning events to clients

This commit is contained in:
Erik Johnston 2015-01-13 09:57:32 +00:00
parent f3467d4646
commit 39585bf556

View file

@ -98,7 +98,7 @@ def serialize_event(hs, e):
d = {k: v for k, v in e.get_dict().items()}
if "age_ts" in d["unsigned"]:
now = int(hs.get_clock().time_msec())
d["unsigned"]["age"] = now - d["unsigned"]["age_ts"]
d["age"] = now - d["unsigned"]["age_ts"]
del d["unsigned"]["age_ts"]
d["user_id"] = d.pop("sender", None)