summary refs log tree commit diff
path: root/webclient/recents/recents-controller.js
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/recents/recents-controller.js
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/recents/recents-controller.js')
-rw-r--r--webclient/recents/recents-controller.js13
1 files changed, 13 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();