Hide mute button when moderator join via audio in breakout room

This commit is contained in:
Tainan Felipe 2019-03-11 18:09:07 -03:00
parent 266eb2a563
commit aa2664d9dd
6 changed files with 29 additions and 8 deletions

View File

@ -27,7 +27,10 @@ export default function addVoiceUser(meetingId, voiceUser) {
const modifier = {
$set: Object.assign(
{ meetingId },
{
meetingId,
updateTime: new Date().getTime(),
},
flat(voiceUser),
),
};

View File

@ -23,7 +23,10 @@ export default function updateVoiceUser(meetingId, voiceUser) {
const modifier = {
$set: Object.assign(
{ meetingId },
{
meetingId,
updateTime: new Date().getTime(),
},
flat(voiceUser),
),
};

View File

@ -11,7 +11,7 @@ function voiceUser(credentials) {
Logger.debug(`Publishing Voice User for ${meetingId} ${requesterUserId}`);
return VoiceUsers.find({ meetingId });
return VoiceUsers.find({ intId: requesterUserId });
}
function publish(...args) {

View File

@ -65,11 +65,12 @@ class AudioControls extends Component {
join,
intl,
shortcuts,
joinedInBreakoutViAudio,
} = this.props;
return (
<span className={styles.container}>
{mute ?
{mute && !joinedInBreakoutViAudio ?
<Button
className={glow ? cx(styles.button, styles.glow) : cx(styles.button, !unmute || styles.ghostButton)}
onClick={handleToggleMuteMicrophone}

View File

@ -2,11 +2,8 @@ import React from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import { withModalMounter } from '/imports/ui/components/modal/service';
import AudioManager from '/imports/ui/services/audio-manager';
import { makeCall } from '/imports/ui/services/api';
import Users from '/imports/api/users/';
import Meetings from '/imports/api/meetings';
import mapUser from '/imports/ui/services/user/mapUser';
import Auth from '/imports/ui/services/auth';
import { makeCall } from '/imports/ui/services/api';
import AudioControls from './component';
import AudioModalContainer from '../audio-modal/container';
import Service from '../service';
@ -42,6 +39,7 @@ export default withModalMounter(withTracker(({ mountModal }) => ({
join: Service.isConnected() && !Service.isEchoTest(),
disable: Service.isConnecting() || Service.isHangingUp(),
glow: Service.isTalking() && !Service.isMuted(),
joinedInBreakoutViAudio: !Service.compareVoiceConf(Auth.userID, Auth.meetingID),
handleToggleMuteMicrophone: () => Service.toggleMuteMicrophone(),
handleJoinAudio: () => {
return Service.isConnected() ? Service.joinListenOnly() : mountModal(<AudioModalContainer />);

View File

@ -1,4 +1,5 @@
import Users from '/imports/api/users';
import voiceUsers from '/imports/api/voice-users';
import Auth from '/imports/ui/services/auth';
import AudioManager from '/imports/ui/services/audio-manager';
import Meetings from '/imports/api/meetings';
@ -30,6 +31,18 @@ const init = (messages, intl) => {
AudioManager.init(userData);
};
const getVoiceUserConf = userId => ({
...voiceUsers.find({ intId: userId },
{ sort: { updateTime: -1 }, limit: 1 })
.fetch().shift(),
}).voiceConf;
const getMeetingVoiceConf = meetingId => Meetings.findOne({ meetingId }).voiceProp.voiceConf;
const compareVoiceConf = (userId, meetingId) => getVoiceUserConf(userId)
=== getMeetingVoiceConf(meetingId);
const audioLocked = () => {
const userId = Auth.userID;
const User = mapUser(Users.findOne({ userId }));
@ -65,4 +78,7 @@ export default {
error: () => AudioManager.error,
isUserModerator: () => Users.findOne({ userId: Auth.userID }).moderator,
audioLocked,
compareVoiceConf,
getVoiceUserConf,
getMeetingVoiceConf,
};