bigbluebutton-Github/bigbluebutton-html5/imports/api/voice-users/server/modifiers/removeVoiceUser.js

39 lines
793 B
JavaScript
Raw Normal View History

2017-08-01 03:36:41 +08:00
import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import VoiceUsers from '/imports/api/voice-users';
2017-08-01 03:36:41 +08:00
export default function removeVoiceUser(meetingId, voiceUser) {
check(meetingId, String);
check(voiceUser, {
voiceConf: String,
voiceUserId: String,
2017-08-01 21:10:12 +08:00
intId: String,
2017-08-01 03:36:41 +08:00
});
2017-08-01 21:10:12 +08:00
const { intId } = voiceUser;
2017-08-01 03:36:41 +08:00
2017-08-01 21:10:12 +08:00
const selector = {
meetingId,
intId,
};
const modifier = {
2017-08-02 21:11:53 +08:00
$set: {
muted: false,
talking: false,
listenOnly: false,
joined: false,
},
2017-08-01 21:10:12 +08:00
};
const cb = (err) => {
if (err) {
2017-08-01 21:55:00 +08:00
return Logger.error(`Remove voiceUser=${intId}: ${err}`);
2017-08-01 21:10:12 +08:00
}
return Logger.info(`Remove voiceUser=${intId} meeting=${meetingId}`);
2017-08-01 21:10:12 +08:00
};
return VoiceUsers.update(selector, modifier, cb);
2017-08-01 03:36:41 +08:00
}