Prevent autoconnect from connecting twice

once from the watcher, once from the autoconnect call.
-> remove the autoconnect call, it is not needed
This commit is contained in:
Lorenz Hübschle-Schneider 2014-07-28 10:02:43 +01:00
parent fcc4d8a888
commit 88424279c7

View file

@ -815,6 +815,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$scope.activeBuffer = models.getActiveBuffer;
$rootScope.connected = false;
$rootScope.waseverconnected = false;
$rootScope.models = models;
@ -898,8 +899,9 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
document.getElementById('content').setAttribute('sidebar-state', 'hidden');
}
};
// This also fires on page load
$scope.$watch('autoconnect', function() {
if ($scope.autoconnect && !$rootScope.connected) {
if ($scope.autoconnect && !$rootScope.connected && !$rootScope.sslError && !$rootScope.securityError && !$rootScope.errorMessage) {
$scope.connect();
}
});
@ -1283,10 +1285,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$scope.favico.reset();
};
if ($scope.autoconnect && !$rootScope.connected && !$rootScope.sslError && !$rootScope.securityError && !$rootScope.errorMessage) {
$scope.connect();
}
}]
);