From 76fe7d4eba334cee8b5c18ac26da709106dff1a2 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Mon, 8 Sep 2014 12:11:36 -0700 Subject: [PATCH] Added num_joined_users key to /publicRooms for each room. Show this information in the webclient. --- synapse/handlers/room.py | 6 ++++++ webclient/app.css | 4 ++++ webclient/home/home.html | 5 ++++- webclient/recents/recents.html | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index a0d0f2af1..310cb46fe 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -593,6 +593,12 @@ class RoomListHandler(BaseHandler): @defer.inlineCallbacks def get_public_room_list(self): chunk = yield self.store.get_rooms(is_public=True) + for room in chunk: + joined_members = yield self.store.get_room_members( + room_id=room["room_id"], + membership=Membership.JOIN + ) + room["num_joined_members"] = len(joined_members) # FIXME (erikj): START is no longer a valid value defer.returnValue({"start": "START", "end": "END", "chunk": chunk}) diff --git a/webclient/app.css b/webclient/app.css index 0c6ae9b66..b438cf040 100755 --- a/webclient/app.css +++ b/webclient/app.css @@ -273,6 +273,10 @@ a:active { color: #000; } font-weight: bold; } +.publicRoomEntry { + margin-bottom: 5px; +} + /*** Participant list ***/ #usersTableWrapper { diff --git a/webclient/home/home.html b/webclient/home/home.html index 12b3c7f14..cf6771814 100644 --- a/webclient/home/home.html +++ b/webclient/home/home.html @@ -25,11 +25,14 @@

Public rooms

-
+
{{ room.room_display_name }} +
+ {{ room.num_joined_members }} {{ room.num_joined_members == 1 ? 'user' : 'users' }} +

diff --git a/webclient/recents/recents.html b/webclient/recents/recents.html index b90341281..efc5c3968 100644 --- a/webclient/recents/recents.html +++ b/webclient/recents/recents.html @@ -9,7 +9,7 @@ {{ room.room_id | mRoomName }} - {{ room.numUsersInRoom }} users + {{ room.numUsersInRoom }} {{ room.numUsersInRoom == 1 ? 'user' : 'users' }} {{ (room.lastMsg.ts) | date:'MMM d HH:mm' }}