summary refs log tree commit diff
path: root/webclient
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-09-08 11:55:19 -0700
committerKegan Dougal <kegan@matrix.org>2014-09-08 11:55:29 -0700
commit2eaa199e6ad2742fbfea54f7d6584bd5c8ac005a (patch)
treee2b569d0269631dc2120deb29c15d5d0b81f3c6d /webclient
parentFix bug in state handling where we incorrectly identified a missing pdu. Upda... (diff)
downloadsynapse-2eaa199e6ad2742fbfea54f7d6584bd5c8ac005a.tar.xz
Added number of users in recent rooms.
Diffstat (limited to 'webclient')
-rw-r--r--webclient/recents/recents-controller.js13
-rw-r--r--webclient/recents/recents.html3
2 files changed, 16 insertions, 0 deletions
diff --git a/webclient/recents/recents-controller.js b/webclient/recents/recents-controller.js
index 45a671e631..fcb203b36c 100644
--- a/webclient/recents/recents-controller.js
+++ b/webclient/recents/recents-controller.js
@@ -76,12 +76,25 @@ angular.module('RecentsController', ['matrixService', 'matrixFilter', 'eventHand
                     if (room.messages && room.messages.chunk && room.messages.chunk[0]) {
                         $rootScope.rooms[room.room_id].lastMsg = room.messages.chunk[0];
                     }
+                    
+                    
+                    var numUsersInRoom = 0;
+                    if (room.state) {
+                        for (var j=0; j<room.state.length; j++) {
+                            var stateEvent = room.state[j];
+                            if (stateEvent.type == "m.room.member" && stateEvent.content.membership == "join") {
+                                numUsersInRoom += 1;
+                            }
+                        }
+                    }
+                    $rootScope.rooms[room.room_id].numUsersInRoom = numUsersInRoom;
                 }
 
                 var presence = initialSyncData.data.presence;
                 for (var i = 0; i < presence.length; ++i) {
                     eventHandlerService.handleEvent(presence[i], false);
                 }
+                
 
                 // From now, update recents from the stream
                 listenToEventStream();
diff --git a/webclient/recents/recents.html b/webclient/recents/recents.html
index 280d0632ab..b903412815 100644
--- a/webclient/recents/recents.html
+++ b/webclient/recents/recents.html
@@ -9,6 +9,9 @@
                     {{ room.room_id | mRoomName }}
                 </td>
                 <td class="recentsRoomSummaryTS">
+                    {{ room.numUsersInRoom }} users
+                </td>
+                <td class="recentsRoomSummaryTS">
                     {{ (room.lastMsg.ts) | date:'MMM d HH:mm' }}
                 </td>
             </tr>