Merge pull request #5840 from Tainan404/issue-5833

Comply audio lock setting.
This commit is contained in:
Anton Georgiev 2018-07-12 14:38:19 -04:00 committed by GitHub
commit f50cf96100
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 0 deletions

View File

@ -273,6 +273,7 @@ class AudioModal extends Component {
listenOnlyMode, listenOnlyMode,
forceListenOnlyAttendee, forceListenOnlyAttendee,
skipCheck, skipCheck,
audioLocked,
} = this.props; } = this.props;
return ( return (
@ -284,6 +285,7 @@ class AudioModal extends Component {
icon="unmute" icon="unmute"
circle circle
size="jumbo" size="jumbo"
disabled={audioLocked}
onClick={skipCheck ? this.handleJoinMicrophone : this.handleGoToEchoTest} onClick={skipCheck ? this.handleJoinMicrophone : this.handleGoToEchoTest}
/> />
: null} : null}

View File

@ -53,6 +53,7 @@ export default withModalMounter(withTracker(({ mountModal }) =>
showPermissionsOvelay: Service.isWaitingPermissions(), showPermissionsOvelay: Service.isWaitingPermissions(),
listenOnlyMode, listenOnlyMode,
skipCheck, skipCheck,
audioLocked: Service.audioLocked(),
joinFullAudioImmediately: !listenOnlyMode && skipCheck, joinFullAudioImmediately: !listenOnlyMode && skipCheck,
joinFullAudioEchoTest: !listenOnlyMode && !skipCheck, joinFullAudioEchoTest: !listenOnlyMode && !skipCheck,
forceListenOnlyAttendee: listenOnlyMode && forceListenOnly && !Service.isUserModerator(), forceListenOnlyAttendee: listenOnlyMode && forceListenOnly && !Service.isUserModerator(),

View File

@ -4,6 +4,7 @@ import { withModalMounter } from '/imports/ui/components/modal/service';
import { injectIntl, defineMessages } from 'react-intl'; import { injectIntl, defineMessages } from 'react-intl';
import _ from 'lodash'; import _ from 'lodash';
import Breakouts from '/imports/api/breakouts'; import Breakouts from '/imports/api/breakouts';
import { notify } from '/imports/ui/services/notification';
import Service from './service'; import Service from './service';
import AudioModalContainer from './audio-modal/container'; import AudioModalContainer from './audio-modal/container';
@ -48,6 +49,10 @@ const intlMessages = defineMessages({
id: 'app.audioNotification.audioFailedError1007', id: 'app.audioNotification.audioFailedError1007',
description: 'ice negociation error messsage', description: 'ice negociation error messsage',
}, },
reconectingAsListener: {
id: 'app.audioNotificaion.reconnectingAsListenOnly',
description: 'ice negociation error messsage',
},
}); });
@ -77,6 +82,11 @@ export default withModalMounter(injectIntl(withTracker(({ mountModal, intl }) =>
null, null,
<AudioModalContainer />, <AudioModalContainer />,
); );
if (Service.audioLocked() && Service.isConnected() && !Service.isListenOnly()) {
Service.exitAudio();
notify(intl.formatMessage(intlMessages.reconectingAsListener), 'info', 'audio_on');
Service.joinListenOnly();
}
Breakouts.find().observeChanges({ Breakouts.find().observeChanges({
removed() { removed() {

View File

@ -2,6 +2,7 @@ import Users from '/imports/api/users';
import Auth from '/imports/ui/services/auth'; import Auth from '/imports/ui/services/auth';
import AudioManager from '/imports/ui/services/audio-manager'; import AudioManager from '/imports/ui/services/audio-manager';
import Meetings from '/imports/api/meetings'; import Meetings from '/imports/api/meetings';
import mapUser from '/imports/ui/services/user/mapUser';
const init = (messages) => { const init = (messages) => {
AudioManager.setAudioMessages(messages); AudioManager.setAudioMessages(messages);
@ -29,6 +30,17 @@ const init = (messages) => {
AudioManager.init(userData); AudioManager.init(userData);
}; };
const audioLocked = () => {
const userId = Auth.userID;
const User = mapUser(Users.findOne({ userId }));
const Meeting = Meetings.findOne({ meetingId: Auth.meetingID });
const lockSetting = Meeting.lockSettingProps;
const audioLock = lockSetting ? lockSetting.disableMic : false;
return audioLock && User.isLocked;
};
export default { export default {
init, init,
exitAudio: () => AudioManager.exitAudio(), exitAudio: () => AudioManager.exitAudio(),
@ -52,4 +64,5 @@ export default {
isEchoTest: () => AudioManager.isEchoTest, isEchoTest: () => AudioManager.isEchoTest,
error: () => AudioManager.error, error: () => AudioManager.error,
isUserModerator: () => Users.findOne({ userId: Auth.userID }).moderator, isUserModerator: () => Users.findOne({ userId: Auth.userID }).moderator,
audioLocked,
}; };

View File

@ -236,6 +236,7 @@
"app.audioNotification.audioFailedMessage": "Your audio connection failed to connect", "app.audioNotification.audioFailedMessage": "Your audio connection failed to connect",
"app.audioNotification.mediaFailedMessage": "getUserMicMedia failed, Only secure origins are allowed", "app.audioNotification.mediaFailedMessage": "getUserMicMedia failed, Only secure origins are allowed",
"app.audioNotification.closeLabel": "Close", "app.audioNotification.closeLabel": "Close",
"app.audioNotificaion.reconnectingAsListenOnly": "Audio has been locked for moderators only, you are being connected as listen only",
"app.breakoutJoinConfirmation.title": "Join Breakout Room", "app.breakoutJoinConfirmation.title": "Join Breakout Room",
"app.breakoutJoinConfirmation.message": "Do you want to join", "app.breakoutJoinConfirmation.message": "Do you want to join",
"app.breakoutJoinConfirmation.confirmLabel": "Join", "app.breakoutJoinConfirmation.confirmLabel": "Join",