Pārlūkot izejas kodu

Fixes muting particular remote participant.

There was a bug that the handlers for menuItem for mute and kick are added for all remote participants. When clicked multiple handlers are executed and the action will be executed for all remote participants.
j8
damencho 8 gadus atpakaļ
vecāks
revīzija
246ab88a3e

+ 7
- 3
modules/UI/videolayout/RemoteVideo.js Parādīt failu

@@ -13,6 +13,7 @@ function RemoteVideo(id, VideoLayout, emitter) {
13 13
     this.emitter = emitter;
14 14
     this.videoSpanId = `participant_${id}`;
15 15
     SmallVideo.call(this, VideoLayout);
16
+    this.hasRemoteVideoMenu = false;
16 17
     this.addRemoteVideoContainer();
17 18
     this.connectionIndicator = new ConnectionIndicator(this, id);
18 19
     this.setDisplayName();
@@ -93,7 +94,7 @@ RemoteVideo.prototype._generatePopupContent = function () {
93 94
         APP.translation.translateString("videothumbnail.muted") +
94 95
         "</div>";
95 96
 
96
-    muteLinkItem.id = "muteLinkItem";
97
+    muteLinkItem.id = "mutelink_" + this.id;
97 98
 
98 99
     if (this.isMuted) {
99 100
         muteLinkItem.innerHTML = mutedHTML;
@@ -105,7 +106,7 @@ RemoteVideo.prototype._generatePopupContent = function () {
105 106
     }
106 107
 
107 108
     // Delegate event to the document.
108
-    $(document).on("click", ".mutelink", function(){
109
+    $(document).on("click", "#mutelink_" + this.id, function(){
109 110
 
110 111
         if (this.isMuted)
111 112
             return;
@@ -130,8 +131,9 @@ RemoteVideo.prototype._generatePopupContent = function () {
130 131
 
131 132
     ejectLinkItem.className = 'ejectlink';
132 133
     ejectLinkItem.innerHTML = ejectIndicator + ' ' + ejectText;
134
+    ejectLinkItem.id = "ejectlink_" + this.id;
133 135
 
134
-    $(document).on("click", ".ejectlink", function(){
136
+    $(document).on("click", "#ejectlink_" + this.id, function(){
135 137
         this.emitter.emit(UIEvents.USER_KICKED, this.id);
136 138
         this.popover.forceHide();
137 139
     }.bind(this));
@@ -178,6 +180,7 @@ if (!interfaceConfig.filmStripOnly) {
178 180
         spanElement.appendChild(menuElement);
179 181
 
180 182
         this._initPopupMenu(this._generatePopupContent());
183
+        this.hasRemoteVideoMenu = true;
181 184
     };
182 185
 
183 186
 } else {
@@ -419,6 +422,7 @@ RemoteVideo.prototype.removeRemoteVideoMenu = function() {
419 422
     if (menuSpan.length) {
420 423
         this.popover.forceHide();
421 424
         menuSpan.remove();
425
+        this.hasRemoteVideoMenu = false;
422 426
     }
423 427
 };
424 428
 

+ 1
- 1
modules/UI/videolayout/VideoLayout.js Parādīt failu

@@ -472,7 +472,7 @@ var VideoLayout = {
472 472
                 remoteVideo.createModeratorIndicatorElement();
473 473
             } else if (isModerator) {
474 474
                 // We are moderator, but user is not - add menu
475
-                if ($(`#remote_popupmenu_${id}`).length <= 0) {
475
+                if(!remoteVideo.hasRemoteVideoMenu) {
476 476
                     remoteVideo.addRemoteVideoMenu();
477 477
                 }
478 478
             }

Notiek ielāde…
Atcelt
Saglabāt