bigbluebutton-Github/bigbluebutton-html5/imports/api/2.0/users/server/modifiers/updateVoiceUser.js
2017-06-28 15:14:29 -03:00

35 lines
877 B
JavaScript
Executable File

import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import Users from '/imports/api/2.0/users';
export default function updateVoiceUser(meetingId, voiceUser) {
check(meetingId, String);
check(voiceUser, Object);
const selector = {
meetingId,
user: voiceUser.intId,
};
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=${voiceUser.intId}: ${err}`);
}
if (numChanged) {
return Logger.verbose(`Updated voice user=${voiceUser.intId} meeting=${meetingId}`);
}
};
return Users.update(selector, modifier, cb);
}