diff options
author | Erik Johnston <erikj@jki.re> | 2017-03-15 16:01:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-15 16:01:29 +0000 |
commit | 9d527191bcd14f51ae43cfccf18a34ecb19df801 (patch) | |
tree | 272a697640aaf3c919db0b63967908e89b8f16f5 /synapse/handlers/initial_sync.py | |
parent | Merge pull request #1997 from matrix-org/dbkr/cas_partialdownload (diff) | |
parent | Comment (diff) | |
download | synapse-9d527191bcd14f51ae43cfccf18a34ecb19df801.tar.xz |
Merge pull request #2013 from matrix-org/erikj/presence_FASTER
Format presence events on the edges instead of reformatting them multiple times
Diffstat (limited to 'synapse/handlers/initial_sync.py')
-rw-r--r-- | synapse/handlers/initial_sync.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/synapse/handlers/initial_sync.py b/synapse/handlers/initial_sync.py index e0ade4c164..10f5f35a69 100644 --- a/synapse/handlers/initial_sync.py +++ b/synapse/handlers/initial_sync.py @@ -19,6 +19,7 @@ from synapse.api.constants import EventTypes, Membership from synapse.api.errors import AuthError, Codes from synapse.events.utils import serialize_event from synapse.events.validator import EventValidator +from synapse.handlers.presence import format_user_presence_state from synapse.streams.config import PaginationConfig from synapse.types import ( UserID, StreamToken, @@ -225,9 +226,17 @@ class InitialSyncHandler(BaseHandler): "content": content, }) + now = self.clock.time_msec() + ret = { "rooms": rooms_ret, - "presence": presence, + "presence": [ + { + "type": "m.presence", + "content": format_user_presence_state(event, now), + } + for event in presence + ], "account_data": account_data_events, "receipts": receipt, "end": now_token.to_string(), |