summary refs log tree commit diff
path: root/webclient/room
diff options
context:
space:
mode:
Diffstat (limited to 'webclient/room')
-rw-r--r--webclient/room/room-controller.js33
-rw-r--r--webclient/room/room.html2
2 files changed, 29 insertions, 6 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index c6028f874e..046d1ca204 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;
+            }
         }
     };
     
@@ -331,6 +337,11 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
         // Make sure the initialSync has been before going further
         eventHandlerService.waitForInitialSyncCompletion().then(
             function() {
+                
+                // Some data has been retrieved from the iniialSync request
+                // So, the relative time starts here
+                $scope.now = new Date().getTime();
+                
                 var needsToJoin = true;
                 
                 // The room members is available in the data fetched by initialSync
@@ -377,10 +388,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) {
diff --git a/webclient/room/room.html b/webclient/room/room.html
index e5e454864b..d5b0f0ab96 100644
--- a/webclient/room/room.html
+++ b/webclient/room/room.html
@@ -106,7 +106,7 @@
                 <button ng-click="answerCall()">Answer</button>
                 <button ng-click="hangupCall()">Reject</button>
                 </div>
-                <button ng-click="hangupCall()" ng-show="currentCall && currentCall.state != 'ringing'">Hang up</button>
+                <button ng-click="hangupCall()" ng-show="currentCall && currentCall.state != 'ringing' && currentCall.state != 'ended' && currentCall.state != 'fledgling'">Hang up</button>
                 <span ng-show="currentCall.state == 'invite_sent'">Calling...</span>
                 <span ng-show="currentCall.state == 'connecting'">Call Connecting...</span>
                 <span ng-show="currentCall.state == 'connected'">Call Connected</span>