Added num_joined_users key to /publicRooms for each room. Show this information in the webclient.

This commit is contained in:
Kegan Dougal 2014-09-08 12:11:36 -07:00
parent 942d8412c4
commit 76fe7d4eba
4 changed files with 15 additions and 2 deletions

View File

@ -593,6 +593,12 @@ class RoomListHandler(BaseHandler):
@defer.inlineCallbacks @defer.inlineCallbacks
def get_public_room_list(self): def get_public_room_list(self):
chunk = yield self.store.get_rooms(is_public=True) 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 # FIXME (erikj): START is no longer a valid value
defer.returnValue({"start": "START", "end": "END", "chunk": chunk}) defer.returnValue({"start": "START", "end": "END", "chunk": chunk})

View File

@ -273,6 +273,10 @@ a:active { color: #000; }
font-weight: bold; font-weight: bold;
} }
.publicRoomEntry {
margin-bottom: 5px;
}
/*** Participant list ***/ /*** Participant list ***/
#usersTableWrapper { #usersTableWrapper {

View File

@ -25,11 +25,14 @@
<h3>Public rooms</h3> <h3>Public rooms</h3>
<div class="public_rooms" ng-repeat="room in public_rooms | orderBy:'room_display_name'"> <div class="public_rooms" ng-repeat="room in public_rooms | orderBy:'room_display_name'">
<div> <div class="publicRoomEntry">
<a href="#/room/{{ room.room_alias ? room.room_alias : room.room_id }}" <a href="#/room/{{ room.room_alias ? room.room_alias : room.room_id }}"
ng-class="room.room_display_name.toLowerCase().indexOf('#matrix:') === 0 ? 'roomHighlight' : ''"> ng-class="room.room_display_name.toLowerCase().indexOf('#matrix:') === 0 ? 'roomHighlight' : ''">
{{ room.room_display_name }} {{ room.room_display_name }}
</a> </a>
<div ng-show="'num_joined_members' in room">
{{ room.num_joined_members }} {{ room.num_joined_members == 1 ? 'user' : 'users' }}
</div>
</div> </div>
</div> </div>
<br/> <br/>

View File

@ -9,7 +9,7 @@
{{ room.room_id | mRoomName }} {{ room.room_id | mRoomName }}
</td> </td>
<td class="recentsRoomSummaryTS"> <td class="recentsRoomSummaryTS">
{{ room.numUsersInRoom }} users {{ room.numUsersInRoom }} {{ room.numUsersInRoom == 1 ? 'user' : 'users' }}
</td> </td>
<td class="recentsRoomSummaryTS"> <td class="recentsRoomSummaryTS">
{{ (room.lastMsg.ts) | date:'MMM d HH:mm' }} {{ (room.lastMsg.ts) | date:'MMM d HH:mm' }}