summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-01-29 16:41:21 +0000
committerMark Haines <mark.haines@matrix.org>2015-01-29 16:41:21 +0000
commit722b65f46131349c5afdcc7eb48297cdd9d9cbd6 (patch)
tree9913ea8b1bccf900ffbad8af7a01fcb492f4ca51
parentFix check for empty room update (diff)
downloadsynapse-722b65f46131349c5afdcc7eb48297cdd9d9cbd6.tar.xz
Move typing notifs to an "emphermal" event list on the room object
Diffstat (limited to '')
-rw-r--r--synapse/handlers/sync.py12
-rw-r--r--synapse/rest/client/v2_alpha/sync.py4
2 files changed, 9 insertions, 7 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index ec8beb4c6a..3860c3c95b 100644
--- a/synapse/handlers/sync.py
+++ b/synapse/handlers/sync.py
@@ -44,12 +44,12 @@ class RoomSyncResult(collections.namedtuple("RoomSyncResult", [
     "events",
     "state",
     "prev_batch",
-    "typing",
+    "ephemeral",
 ])):
     __slots__ = []
 
     def __nonzero__(self):
-        return bool(self.events or self.state or self.typing)
+        return bool(self.events or self.state or self.ephemeral)
 
 
 class SyncResult(collections.namedtuple("SyncResult", [
@@ -180,7 +180,7 @@ class SyncHandler(BaseHandler):
             prev_batch=prev_batch_token,
             state=current_state_events,
             limited=True,
-            typing=None,
+            ephemeral=[],
         ))
 
     @defer.inlineCallbacks
@@ -214,7 +214,9 @@ class SyncHandler(BaseHandler):
         )
         now_token = now_token.copy_and_replace("typing_key", typing_key)
 
-        typing_by_room = {event["room_id"]: event for event in typing}
+        typing_by_room = {event["room_id"]: [event] for event in typing}
+        for event in typing:
+            event.pop("room_id")
         logger.debug("Typing %r", typing_by_room)
 
         rm_handler = self.hs.get_handlers().room_member_handler
@@ -256,7 +258,7 @@ class SyncHandler(BaseHandler):
                     prev_batch=prev_batch,
                     state=state,
                     limited=False,
-                    typing=typing_by_room.get(room_id, None)
+                    ephemeral=typing_by_room.get(room_id, [])
                 )
                 if room_sync:
                     rooms.append(room_sync)
diff --git a/synapse/rest/client/v2_alpha/sync.py b/synapse/rest/client/v2_alpha/sync.py
index 76489e27c8..2ae2eec55d 100644
--- a/synapse/rest/client/v2_alpha/sync.py
+++ b/synapse/rest/client/v2_alpha/sync.py
@@ -66,6 +66,7 @@ class SyncRestServlet(RestServlet):
                 }
                 "state": [] // list of EventIDs updating the current state to
                             // be what it should be at the end of the batch.
+                "ephemeral": []
             }]
         }
     """
@@ -188,9 +189,8 @@ class SyncRestServlet(RestServlet):
             "state": state_event_ids,
             "limited": room.limited,
             "published": room.published,
+            "ephemeral": room.ephemeral,
         }
-        if room.typing is not None:
-            result["typing"] = room.typing
         return result