bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/modifiers/updateVoiceUser.js
2017-03-07 17:32:24 +00:00

36 lines
874 B
JavaScript
Executable File

import { check } from 'meteor/check';
import Users from '/imports/api/users';
import Logger from '/imports/startup/server/logger';
export default function updateVoiceUser(meetingId, userId, voiceUser) {
check(meetingId, String);
check(userId, String);
check(voiceUser, Object);
const selector = {
meetingId,
userId,
};
const modifier = {
$set: {
'user.voiceUser.talking': voiceUser.talking,
'user.voiceUser.joined': voiceUser.joined,
'user.voiceUser.locked': voiceUser.locked,
'user.voiceUser.muted': voiceUser.muted,
},
};
const cb = (err, numChanged) => {
if (err) {
return Logger.error(`Updating voice user=${userId}: ${err}`);
}
if (numChanged) {
return Logger.verbose(`Updated voice user=${userId} meeting=${meetingId}`);
}
};
return Users.update(selector, modifier, cb);
};