From a8f817555d32519cf2cad27e3d16dd20f914b4e0 Mon Sep 17 00:00:00 2001
From: prlanzarin <4529051+prlanzarin@users.noreply.github.com>
Date: Mon, 25 Jan 2021 22:01:26 -0300
Subject: [PATCH] audio: fix talking-indicator mute debounce

The debounce method argument was being passed wrong (its supposed to be a method, not a function call), thus spewing exceptions in the console and rendering the debounce virtually ineffective
---
 .../ui/components/nav-bar/talking-indicator/container.jsx  | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/bigbluebutton-html5/imports/ui/components/nav-bar/talking-indicator/container.jsx b/bigbluebutton-html5/imports/ui/components/nav-bar/talking-indicator/container.jsx
index ec0309527b..36fcd5d036 100644
--- a/bigbluebutton-html5/imports/ui/components/nav-bar/talking-indicator/container.jsx
+++ b/bigbluebutton-html5/imports/ui/components/nav-bar/talking-indicator/container.jsx
@@ -10,6 +10,7 @@ import Service from './service';
 
 const APP_CONFIG = Meteor.settings.public.app;
 const { enableTalkingIndicator } = APP_CONFIG;
+const TALKING_INDICATOR_MUTE_INTERVAL = 500;
 
 const TalkingIndicatorContainer = (props) => {
   if (!enableTalkingIndicator) return null;
@@ -47,7 +48,7 @@ export default withTracker(() => {
     }
   }
 
-  const muteUser = (id) => {
+  const muteUser = debounce((id) => {
     const user = VoiceUsers.findOne({ meetingId, voiceUserId: id }, {
       fields: {
         muted: 1,
@@ -55,11 +56,11 @@ export default withTracker(() => {
     });
     if (user.muted) return;
     makeCall('toggleVoice', id);
-  };
+  }, TALKING_INDICATOR_MUTE_INTERVAL, { leading: true, trailing: false });
 
   return {
     talkers,
-    muteUser: id => debounce(muteUser(id), 500, { leading: true, trailing: false }),
+    muteUser,
     openPanel: Session.get('openPanel'),
     isBreakoutRoom: meetingIsBreakout(),
   };
-- 
GitLab