forked from MirrorHub/synapse
Added num_joined_users key to /publicRooms for each room. Show this information in the webclient.
This commit is contained in:
parent
942d8412c4
commit
76fe7d4eba
4 changed files with 15 additions and 2 deletions
|
@ -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})
|
||||
|
||||
|
|
|
@ -273,6 +273,10 @@ a:active { color: #000; }
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
.publicRoomEntry {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
/*** Participant list ***/
|
||||
|
||||
#usersTableWrapper {
|
||||
|
|
|
@ -25,11 +25,14 @@
|
|||
<h3>Public rooms</h3>
|
||||
|
||||
<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 }}"
|
||||
ng-class="room.room_display_name.toLowerCase().indexOf('#matrix:') === 0 ? 'roomHighlight' : ''">
|
||||
{{ room.room_display_name }}
|
||||
</a>
|
||||
<div ng-show="'num_joined_members' in room">
|
||||
{{ room.num_joined_members }} {{ room.num_joined_members == 1 ? 'user' : 'users' }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
{{ room.room_id | mRoomName }}
|
||||
</td>
|
||||
<td class="recentsRoomSummaryTS">
|
||||
{{ room.numUsersInRoom }} users
|
||||
{{ room.numUsersInRoom }} {{ room.numUsersInRoom == 1 ? 'user' : 'users' }}
|
||||
</td>
|
||||
<td class="recentsRoomSummaryTS">
|
||||
{{ (room.lastMsg.ts) | date:'MMM d HH:mm' }}
|
||||
|
|
Loading…
Reference in a new issue