summary refs log tree commit diff
path: root/webclient/room/room-controller.js
diff options
context:
space:
mode:
authorEmmanuel ROHEE <erohee@amdocs.com>2014-09-01 16:21:13 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-09-01 16:22:59 +0200
commitc9ee9b45c74d690f49f454b62170feb0f5483d38 (patch)
treead61f0c3c9b2cac7f95fa5c4d64a87cae1f1b825 /webclient/room/room-controller.js
parentRename 'state' presence key to the much more obvious 'presence'; maintain a l... (diff)
downloadsynapse-c9ee9b45c74d690f49f454b62170feb0f5483d38.tar.xz
Fixed presence state update. Specifically, the current user was sometimes indicated as offline
Diffstat (limited to '')
-rw-r--r--webclient/room/room-controller.js28
1 files changed, 23 insertions, 5 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index c6028f874e..048350110b 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -201,9 +201,15 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
             }
         }
         else {
-            // selectively update membership else it will nuke the picture and displayname too :/
+            // selectively update membership and presence else it will nuke the picture and displayname too :/
             var member = $scope.members[target_user_id];
-            member.content.membership = chunk.content.membership;
+            member.membership = chunk.content.membership;
+            if ("state" in chunk.content) {
+                member.presenceState = chunk.content.state;
+            }
+            if ("mtime_age" in chunk.content) {
+                member.mtime_age = chunk.content.mtime_age;
+            }
         }
     };
     
@@ -377,10 +383,22 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
 
         // Make recents highlight the current room
         $scope.recentsSelectedRoomID = $scope.room_id;
-                
+
+		// Get the up-to-date the current member list
+        matrixService.getMemberList($scope.room_id).then(
+            function(response) {
+                for (var i = 0; i < response.data.chunk.length; i++) {
+                    var chunk = response.data.chunk[i];
+                    updateMemberList(chunk);
+                    updateMemberListPresenceAge();
+                }
+            },
+            function(error) {
+                $scope.feedback = "Failed get member list: " + error.data.error;
+            }
+        );
+
         paginate(MESSAGES_PER_PAGINATION);
-        
-        updateMemberListPresenceAge();
     }; 
     
     $scope.inviteUser = function(user_id) {