From 4d11faf09510a5ad16e60d2ed6a411106578d234 2016-10-04 16:43:59 From: Marcin Lulek Date: 2016-10-04 16:43:59 Subject: [PATCH] channelstream: add state holder --- diff --git a/backend/src/appenlight/static/js/appenlight.js b/backend/src/appenlight/static/js/appenlight.js index 6c92094..d3f3b31 100644 --- a/backend/src/appenlight/static/js/appenlight.js +++ b/backend/src/appenlight/static/js/appenlight.js @@ -7030,9 +7030,12 @@ angular.module('appenlight.components.channelstream', []) } }); -ChannelstreamController.$inject = ['$rootScope','userSelfPropertyResource']; +ChannelstreamController.$inject = ['$rootScope', 'stateHolder', 'userSelfPropertyResource']; -function ChannelstreamController($rootScope, userSelfPropertyResource){ +function ChannelstreamController($rootScope, stateHolder, userSelfPropertyResource){ + if (stateHolder.AeUser.id === null){ + return + } userSelfPropertyResource.get({key: 'websocket'}, function (data) { stateHolder.websocket = new ReconnectingWebSocket(this.config.ws_url + '/ws?conn_id=' + data.conn_id); stateHolder.websocket.onopen = function (event) { @@ -12737,8 +12740,8 @@ angular.module('appenlight.services.resources').factory('resourcesPropertyResour // # services, and proprietary license terms, please see // # https://rhodecode.com/licenses/ -angular.module('appenlight.services.stateHolder', []).factory('stateHolder', - ['$timeout', '$rootScope', 'AeConfig', function ($timeout, $rootScope, AeConfig) { +angular.module('appenlight.services.stateHolder', []).factory('stateHolder', + ['$timeout', 'AeConfig', function ($timeout, AeConfig) { var AeUser = {"user_name": null, "id": null}; AeUser.update = function (jsonData) { diff --git a/frontend/src/components/channelstream.js b/frontend/src/components/channelstream.js index 90f6ee8..4a4f69a 100644 --- a/frontend/src/components/channelstream.js +++ b/frontend/src/components/channelstream.js @@ -25,9 +25,12 @@ angular.module('appenlight.components.channelstream', []) } }); -ChannelstreamController.$inject = ['$rootScope','userSelfPropertyResource']; +ChannelstreamController.$inject = ['$rootScope', 'stateHolder', 'userSelfPropertyResource']; -function ChannelstreamController($rootScope, userSelfPropertyResource){ +function ChannelstreamController($rootScope, stateHolder, userSelfPropertyResource){ + if (stateHolder.AeUser.id === null){ + return + } userSelfPropertyResource.get({key: 'websocket'}, function (data) { stateHolder.websocket = new ReconnectingWebSocket(this.config.ws_url + '/ws?conn_id=' + data.conn_id); stateHolder.websocket.onopen = function (event) {