summary refs log tree commit diff
path: root/synapse/handlers/sync.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-10-13 11:03:48 +0100
committerMark Haines <mark.haines@matrix.org>2015-10-13 11:03:48 +0100
commitab9cf732585244781ba67f4bb4c235ded3d4661a (patch)
tree5c4a2dd1289ee0906928ca66926d73ca230cc0e1 /synapse/handlers/sync.py
parentMerge branch 'develop' into markjh/v2_sync_api (diff)
downloadsynapse-ab9cf732585244781ba67f4bb4c235ded3d4661a.tar.xz
Include invited rooms in the initial sync
Diffstat (limited to 'synapse/handlers/sync.py')
-rw-r--r--synapse/handlers/sync.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index e693e7c80e..574412d6b5 100644
--- a/synapse/handlers/sync.py
+++ b/synapse/handlers/sync.py
@@ -63,16 +63,10 @@ class JoinedSyncResult(collections.namedtuple("JoinedSyncResult", [
 
 class InvitedSyncResult(collections.namedtuple("InvitedSyncResult", [
     "room_id",
-    "invite_state",
+    "invite",
 ])):
     __slots__ = []
 
-    def __nonzero__(self):
-        """Make the result appear empty if there are no updates. This is used
-        to tell if room needs to be part of the sync result.
-        """
-        return bool(self.invite_state)
-
 
 class SyncResult(collections.namedtuple("SyncResult", [
     "next_batch",  # Token for the next sync
@@ -166,6 +160,7 @@ class SyncHandler(BaseHandler):
         )
 
         joined = []
+        invited = []
         for event in room_list:
             if event.membership == Membership.JOIN:
                 room_sync = yield self.initial_sync_for_room(
@@ -173,15 +168,16 @@ class SyncHandler(BaseHandler):
                 )
                 joined.append(room_sync)
             elif event.membership == Membership.INVITE:
+                invite = yield self.store.get_event(event.event_id)
                 invited.append(InvitedSyncResult(
                     room_id=event.room_id,
-                    invited_state=[event],
-                )
+                    invite=invite,
+                ))
 
         defer.returnValue(SyncResult(
             presence=presence,
             joined=joined,
-            invited=[],
+            invited=invited,
             next_batch=now_token,
         ))