bigbluebutton-Github/bigbluebutton-html5/imports/api/2.0/voice-users/server/modifiers/updateVoiceUser.js
2017-08-01 10:55:00 -03:00

38 lines
874 B
JavaScript

import { Match, check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import VoiceUsers from '/imports/api/2.0/voice-users';
import flat from 'flat';
export default function removeVoiceUser(meetingId, voiceUser) {
check(meetingId, String);
check(voiceUser, {
intId: String,
voiceUserId: String,
talking: Match.Maybe(Boolean),
muted: Match.Maybe(Boolean),
voiceConf: String,
});
const selector = {
meetingId,
intId: voiceUser.intId,
};
const modifier = {
$set: Object.assign(
{ meetingId },
flat(voiceUser),
),
};
const cb = (err) => {
if (err) {
return Logger.error(`Update voiceUser=${voiceUser.intId}: ${err}`);
}
return Logger.verbose(`Update voiceUser=${voiceUser.intId} meeting=${meetingId}`);
};
return VoiceUsers.update(selector, modifier, cb);
}