From ad34d73ccc5764fc968edcf7bcc599555a4af0a8 Mon Sep 17 00:00:00 2001 From: Anton Georgiev Date: Fri, 31 Mar 2017 15:22:44 -0400 Subject: [PATCH] Fix listenOnly status not set --- .../imports/api/audio/client/bridge/manager.js | 2 +- bigbluebutton-html5/imports/api/audio/client/bridge/sip.js | 4 ++-- .../imports/api/users/server/methods/listenOnlyToggle.js | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/bigbluebutton-html5/imports/api/audio/client/bridge/manager.js b/bigbluebutton-html5/imports/api/audio/client/bridge/manager.js index e68fda178e..feb9dd6bc0 100644 --- a/bigbluebutton-html5/imports/api/audio/client/bridge/manager.js +++ b/bigbluebutton-html5/imports/api/audio/client/bridge/manager.js @@ -16,7 +16,7 @@ export default class AudioBridge { joinAudio(listenOnly) { if (listenOnly) { - callServer('listenOnlyRequestToggle', true); + callServer('listenOnlyToggle', true); this.bridge.joinListenOnly(); } else { this.bridge.joinMicrophone(); diff --git a/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js b/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js index 50a222df16..e4a958ac12 100644 --- a/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js +++ b/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js @@ -23,7 +23,7 @@ export default class SIPBridge extends BaseAudioBridge { } joinListenOnly() { - callServer('listenOnlyRequestToggle', true); + callServer('listenOnlyToggle', true); this._joinVoiceCallSIP({ isListenOnly: true }); } @@ -54,7 +54,7 @@ export default class SIPBridge extends BaseAudioBridge { // notify BBB-apps we are leaving the call call if we are listen only if (this._amIListenOnly()) { - callServer('listenOnlyRequestToggle', false); + callServer('listenOnlyToggle', false); } window.webrtc_hangup(hangupCallback); diff --git a/bigbluebutton-html5/imports/api/users/server/methods/listenOnlyToggle.js b/bigbluebutton-html5/imports/api/users/server/methods/listenOnlyToggle.js index 6bbc5237a1..3bd3efcfa5 100755 --- a/bigbluebutton-html5/imports/api/users/server/methods/listenOnlyToggle.js +++ b/bigbluebutton-html5/imports/api/users/server/methods/listenOnlyToggle.js @@ -16,13 +16,15 @@ export default function listenOnlyToggle(credentials, isJoining = true) { check(requesterUserId, String); check(isJoining, Boolean); + let EVENT_NAME = undefined; + if (isJoining) { - let EVENT_NAME = 'user_connected_to_global_audio'; + EVENT_NAME = 'user_connected_to_global_audio'; if (!isAllowedTo('joinListenOnly', credentials)) { throw new Meteor.Error('not-allowed', `You are not allowed to joinListenOnly`); } } else { - let EVENT_NAME = 'user_disconnected_from_global_audio'; + EVENT_NAME = 'user_disconnected_from_global_audio'; if (!isAllowedTo('leaveListenOnly', credentials)) { throw new Meteor.Error('not-allowed', `You are not allowed to leaveListenOnly`); } @@ -40,6 +42,7 @@ export default function listenOnlyToggle(credentials, isJoining = true) { meetingId, userId: requesterUserId, }); + if (!User) { throw new Meteor.Error( 'user-not-found', `You need a valid user to be able to toggle audio`);