From 613569ff0977018497c492f02adbbc923fcd42b0 Mon Sep 17 00:00:00 2001 From: damencho Date: Sat, 9 Apr 2016 12:04:01 -0500 Subject: [PATCH 1/2] Checks whether we need to modify document, before change - on display name change. --- modules/UI/side_pannels/contactlist/ContactList.js | 4 +++- modules/UI/videolayout/RemoteVideo.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/UI/side_pannels/contactlist/ContactList.js b/modules/UI/side_pannels/contactlist/ContactList.js index 267b78d7e..d5c23bb68 100644 --- a/modules/UI/side_pannels/contactlist/ContactList.js +++ b/modules/UI/side_pannels/contactlist/ContactList.js @@ -153,12 +153,14 @@ var ContactList = { }, onDisplayNameChange (id, displayName) { + if(!displayName) + return; if (id === 'localVideoContainer') { id = APP.conference.localId; } let contactName = $(`#contacts #${id}>p`); - if (displayName) { + if (contactName.text() !== displayName) { contactName.text(displayName); } }, diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js index 7747ea822..32c3fd114 100644 --- a/modules/UI/videolayout/RemoteVideo.js +++ b/modules/UI/videolayout/RemoteVideo.js @@ -357,7 +357,9 @@ RemoteVideo.prototype.setDisplayName = function(displayName, key) { // If we already have a display name for this video. if (nameSpan.length > 0) { if (displayName && displayName.length > 0) { - $('#' + this.videoSpanId + '_name').text(displayName); + var displaynameSpan = $('#' + this.videoSpanId + '_name'); + if (displaynameSpan.text() !== displayName) + displaynameSpan.text(displayName); } else if (key && key.length > 0) { var nameHtml = APP.translation.generateTranslationHTML(key); From 0974e31da1d2066f5260725445dfbeb14e377245 Mon Sep 17 00:00:00 2001 From: damencho Date: Sat, 9 Apr 2016 12:35:54 -0500 Subject: [PATCH 2/2] Updates connection quality popover only if its visible or about to be visible. --- modules/UI/videolayout/ConnectionIndicator.js | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/modules/UI/videolayout/ConnectionIndicator.js b/modules/UI/videolayout/ConnectionIndicator.js index 589f15ffe..fc39427e6 100644 --- a/modules/UI/videolayout/ConnectionIndicator.js +++ b/modules/UI/videolayout/ConnectionIndicator.js @@ -270,6 +270,17 @@ ConnectionIndicator.prototype.create = function () { APP.translation.translateString("connectionindicator.na") + "", skin: "black"}); + // override popover show method to make sure we will update the content + // before showing the popover + var origShowFunc = this.popover.show; + this.popover.show = function () { + // update content by forcing it, to finish even if popover + // is not visible + this.updatePopoverData(true); + // call the original show, passing its actual this + origShowFunc.call(this.popover); + }.bind(this); + this.emptyIcon = this.connectionIndicatorContainer.appendChild( createIcon(["connection", "connection_empty"])); this.fullIcon = this.connectionIndicatorContainer.appendChild( @@ -335,13 +346,18 @@ ConnectionIndicator.prototype.updateResolution = function (resolution) { }; /** - * Updates the content of the popover + * Updates the content of the popover if its visible + * @param force to work even if popover is not visible */ -ConnectionIndicator.prototype.updatePopoverData = function () { - this.popover.updateContent( - `
${this.generateText()}
` - ); - APP.translation.translateElement($(".connection_info")); +ConnectionIndicator.prototype.updatePopoverData = function (force) { + // generate content, translate it and add it to document only if + // popover is visible or we force to do so. + if(this.popover.popoverShown || force) { + this.popover.updateContent( + `
${this.generateText()}
` + ); + APP.translation.translateElement($(".connection_info")); + } }; /**