summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Wagner-Hall <daniel@matrix.org>2015-11-13 15:44:57 +0000
committerDaniel Wagner-Hall <daniel@matrix.org>2015-11-13 15:44:57 +0000
commit641420c5e0ca074c6873ee800e14a4e881447ec3 (patch)
treee5087cef5f4cd127d7252dc7a1415a8c12ffcbeb
parentMerge pull request #374 from matrix-org/daniel/guestleave (diff)
downloadsynapse-641420c5e0ca074c6873ee800e14a4e881447ec3.tar.xz
Clean up room initialSync for guest users
-rw-r--r--synapse/handlers/message.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index 14051aee99..a92409c6a2 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -588,23 +588,28 @@ class MessageHandler(BaseHandler):
 
         @defer.inlineCallbacks
         def get_presence():
-            states = {}
-            if not is_guest:
-                states = yield presence_handler.get_states(
-                    target_users=[UserID.from_string(m.user_id) for m in room_members],
-                    auth_user=auth_user,
-                    as_event=True,
-                    check_auth=False,
-                )
+            states = yield presence_handler.get_states(
+                target_users=[UserID.from_string(m.user_id) for m in room_members],
+                auth_user=auth_user,
+                as_event=True,
+                check_auth=False,
+            )
 
             defer.returnValue(states.values())
 
-        receipts_handler = self.hs.get_handlers().receipts_handler
+        @defer.inlineCallbacks
+        def get_receipts():
+            receipts_handler = self.hs.get_handlers().receipts_handler
+            receipts = yield receipts_handler.get_receipts_for_room(
+                room_id,
+                now_token.receipt_key
+            )
+            defer.returnValue(receipts)
 
         presence, receipts, (messages, token) = yield defer.gatherResults(
             [
                 get_presence(),
-                receipts_handler.get_receipts_for_room(room_id, now_token.receipt_key),
+                get_receipts(),
                 self.store.get_recent_events_for_room(
                     room_id,
                     limit=limit,