summary refs log tree commit diff
path: root/webclient/app-controller.js
diff options
context:
space:
mode:
authorDavid Baker <dbkr@matrix.org>2014-09-10 11:12:02 +0100
committerDavid Baker <dbkr@matrix.org>2014-09-10 11:12:02 +0100
commit55fe0d8adce870cc665f5e68f9cbfaf36ba2617a (patch)
tree38fc83d63039c32dd1ee79545d2570f12cf2fd71 /webclient/app-controller.js
parentreject calls if there's already a call in progress (diff)
downloadsynapse-55fe0d8adce870cc665f5e68f9cbfaf36ba2617a.tar.xz
Less buggy rejection of calls when busy
Diffstat (limited to '')
-rw-r--r--webclient/app-controller.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/webclient/app-controller.js b/webclient/app-controller.js
index f8a0d8d35c..55397ed216 100644
--- a/webclient/app-controller.js
+++ b/webclient/app-controller.js
@@ -134,6 +134,7 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
         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;
@@ -152,13 +153,15 @@ angular.module('MatrixWebClientController', ['matrixService', 'mPresence', 'even
         $scope.feedback = errStr;
     }
 
-    $rootScope.onCallHangup = function() {
-        $timeout(function() {
-            var icon = angular.element('#callEndedIcon');
-            $animate.addClass(icon, 'callIconRotate');
-            $timeout(function(){
-                $rootScope.currentCall = undefined;
-            }, 4070);
-        }, 100);
+    $rootScope.onCallHangup = function(call) {
+        if (call == $rootScope.currentCall) {
+            $timeout(function() {
+                var icon = angular.element('#callEndedIcon');
+                $animate.addClass(icon, 'callIconRotate');
+                $timeout(function(){
+                    $rootScope.currentCall = undefined;
+                }, 4070);
+            }, 100);
+        }
     }
 }]);