summary refs log tree commit diff
path: root/webclient/app-controller.js
diff options
context:
space:
mode:
authorEmmanuel ROHEE <erohee@amdocs.com>2014-09-10 18:35:05 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-09-10 18:35:05 +0200
commit44998ca4508c9ed13e563383f1209e7be6ee2e56 (patch)
tree90870576ecb61d488efb0d9c9ec7697d46ab98a1 /webclient/app-controller.js
parentShow echoed emote with transparency (diff)
parentAnimation on call end icon. (diff)
downloadsynapse-44998ca4508c9ed13e563383f1209e7be6ee2e56.tar.xz
Merge remote-tracking branch 'origin/develop' into webclient_initialSync
Diffstat (limited to 'webclient/app-controller.js')
-rw-r--r--webclient/app-controller.js20
1 files changed, 14 insertions, 6 deletions
diff --git a/webclient/app-controller.js b/webclient/app-controller.js
index f28da87ccc..8383533cfb 100644
--- a/webclient/app-controller.js
+++ b/webclient/app-controller.js
@@ -96,9 +96,14 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
         delete roomMembers[matrixService.config().user_id];
 
         $rootScope.currentCall.user_id = Object.keys(roomMembers)[0];
+
+        // set it to the user ID until we fetch the display name
+        $rootScope.currentCall.userProfile = { displayname: $rootScope.currentCall.user_id };
+
         matrixService.getProfile($rootScope.currentCall.user_id).then(
             function(response) {
-                $rootScope.currentCall.userProfile = response.data;
+                if (response.data.displayname) $rootScope.currentCall.userProfile.displayname = response.data.displayname;
+                if (response.data.avatar_url) $rootScope.currentCall.userProfile.avatar_url = response.data.avatar_url;
             },
             function(error) {
                 $scope.feedback = "Can't load user profile";
@@ -131,6 +136,11 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
 
     $rootScope.$on(matrixPhoneService.INCOMING_CALL_EVENT, function(ngEvent, call) {
         console.trace("incoming call");
+        if ($rootScope.currentCall && $rootScope.currentCall.state != 'ended') {
+            console.trace("rejecting call because we're already in a call");
+            call.hangup();
+            return;
+        }
         call.onError = $scope.onCallError;
         call.onHangup = $scope.onCallHangup;
         $rootScope.currentCall = call;
@@ -148,13 +158,11 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
         $scope.feedback = errStr;
     }
 
-    $rootScope.onCallHangup = function() {
-        $timeout(function() {
-            var icon = angular.element('#callEndedIcon');
-            $animate.addClass(icon, 'callIconRotate');
+    $rootScope.onCallHangup = function(call) {
+        if (call == $rootScope.currentCall) {
             $timeout(function(){
                 $rootScope.currentCall = undefined;
             }, 4070);
-        }, 100);
+        }
     }
 }]);