From 7627b3992575c29d3df161531eed232e8592c2d9 Mon Sep 17 00:00:00 2001 From: Nuwan Date: Wed, 16 Jun 2021 22:30:54 +0530 Subject: [PATCH] musiian latency badge error fixing --- web/app/assets/javascripts/hoverMusician.js | 11 ++++++++--- .../react-components/stores/LatencyStore.js.coffee | 7 +++++-- web/config/environments/development.rb | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/web/app/assets/javascripts/hoverMusician.js b/web/app/assets/javascripts/hoverMusician.js index 6ba555576..a4f7ff70e 100644 --- a/web/app/assets/javascripts/hoverMusician.js +++ b/web/app/assets/javascripts/hoverMusician.js @@ -132,6 +132,7 @@ $(hoverSelector).css(css); $(hoverSelector).fadeIn(500); + logger.debug("before bindUserLatencyUpdate userId=", userId) bindUserLatencyUpdate(userId); LatencyActions.resolve([userId]); @@ -187,10 +188,13 @@ } function bindUserLatencyUpdate(userId){ - var latency; + // var latency; $(document).on('user_latency_update', function(e, latencyResp){ - var userLatency = latencyResp['users'].find(function(latency) { + logger.debug("bindUserLatencyUpdate", latencyResp); + logger.debug("bindUserLatencyUpdate.userId", userId); + + var userLatency = latencyResp.find(function(latency) { return latency.user_id === userId; }); @@ -201,7 +205,7 @@ }else{ showUnknownLatencyBadge(userId); } - }); + }) } function bindUserLatencyFail(){ @@ -257,6 +261,7 @@ } this.hideBubble = function() { + logger.debug("hideBubble called") unbindUserLatencyUpdate(); unbindUserLatencyFail(); //$(hoverSelector).hide(); diff --git a/web/app/assets/javascripts/react-components/stores/LatencyStore.js.coffee b/web/app/assets/javascripts/react-components/stores/LatencyStore.js.coffee index c3f12ab83..0d9426f05 100644 --- a/web/app/assets/javascripts/react-components/stores/LatencyStore.js.coffee +++ b/web/app/assets/javascripts/react-components/stores/LatencyStore.js.coffee @@ -15,6 +15,7 @@ rest = new context.JK.Rest() onAppInit: (@app) -> changed: () -> + logger.debug("LatencyStore.latencies = ", @latencies) $(document).triggerHandler("user_latency_update", @latencies) @trigger(@latencies) @@ -22,8 +23,10 @@ rest = new context.JK.Rest() rest.getLatencyToUsers({user_ids: user_ids}).done((response) => @onLoaded(response)).fail((jqXHR) => @onLatencyFail(jqXHR, [user_ids])) onLoaded: (response) -> - logger.debug("LatencyStore.onLoaded", response); - @latencies.push(response) + logger.debug("LatencyStore.onLoaded response", response) + usersLatencies = response.users + @latencies = @latencies.concat(usersLatencies) + @latencies = _.uniq(@latencies) @changed() onLatencyFail:(jqXHR, user_ids) -> diff --git a/web/config/environments/development.rb b/web/config/environments/development.rb index c0b3bf258..f63373c8a 100644 --- a/web/config/environments/development.rb +++ b/web/config/environments/development.rb @@ -114,6 +114,6 @@ SampleApp::Application.configure do config.video_conferencing_host = "https://webrtc-demo.jamkazam.com" config.use_video_conferencing_server = true - config.latency_data_host = "http://localhost:4001/dev" + config.latency_data_host = "http://localhost:4001/local" config.latency_data_host_auth_code = "c2VydmVyOnBhc3N3b3Jk" end