summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-04-13 14:07:26 +0100
committerErik Johnston <erik@matrix.org>2016-04-13 14:07:26 +0100
commit5880bc5417627f5fe675f0ea7738bb84783e55df (patch)
treeb1d14726a8e2c3e4ece4b6c3548e826cb70ce60b /synapse
parentMerge pull request #720 from matrix-org/erikj/auth_chec (diff)
parentDon't return empty public rooms (diff)
downloadsynapse-5880bc5417627f5fe675f0ea7738bb84783e55df.tar.xz
Merge pull request #718 from matrix-org/erikj/public_room_list
Don't return empty public rooms
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/room.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index ea306cd42a..dd9c18df84 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -358,8 +358,6 @@ class RoomListHandler(BaseHandler):
 
         @defer.inlineCallbacks
         def handle_room(room_id):
-            aliases = yield self.store.get_aliases_for_room(room_id)
-
             # We pull each bit of state out indvidually to avoid pulling the
             # full state into memory. Due to how the caching works this should
             # be fairly quick, even if not originally in the cache.
@@ -374,6 +372,14 @@ class RoomListHandler(BaseHandler):
                     defer.returnValue(None)
 
             result = {"room_id": room_id}
+
+            joined_users = yield self.store.get_users_in_room(room_id)
+            if len(joined_users) == 0:
+                return
+
+            result["num_joined_members"] = len(joined_users)
+
+            aliases = yield self.store.get_aliases_for_room(room_id)
             if aliases:
                 result["aliases"] = aliases
 
@@ -413,9 +419,6 @@ class RoomListHandler(BaseHandler):
                 if avatar_url:
                     result["avatar_url"] = avatar_url
 
-            joined_users = yield self.store.get_users_in_room(room_id)
-            result["num_joined_members"] = len(joined_users)
-
             results.append(result)
 
         yield concurrently_execute(handle_room, room_ids, 10)