bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/modifiers/updateVoiceUser.js
Anton Georgiev 8d52dc1b40 Merge branch 'join-components-with-skeleton' of github.com:perroned/bigbluebutton into router-merging
Conflicts:
	bigbluebutton-html5/imports/api/chat/server/methods/sendChatMessagetoServer.js
	bigbluebutton-html5/imports/api/meetings/server/modifiers/addMeetingToCollection.js
	bigbluebutton-html5/imports/api/polls/server/methods/publishVoteMessage.js
	bigbluebutton-html5/imports/api/slides/server/modifiers/clearSlidesCollection.js
	bigbluebutton-html5/imports/api/users/server/methods/muteUser.js
	bigbluebutton-html5/imports/api/users/server/methods/setUserPresenter.js
	bigbluebutton-html5/imports/api/users/server/methods/unmuteUser.js
	bigbluebutton-html5/imports/api/users/server/methods/userSetEmoji.js
	bigbluebutton-html5/imports/api/users/server/methods/validateAuthToken.js
	bigbluebutton-html5/imports/startup/server/eventHandlers.js
	bigbluebutton-html5/imports/ui/components/app/AppService.js
2016-05-16 19:54:51 +00:00

98 lines
2.8 KiB
JavaScript
Executable File

import Users from '/imports/api/users';
import { logger } from '/imports/startup/server/logger';
//update a voiceUser - a helper method
export function updateVoiceUser(meetingId, voiceUserObject, callback) {
let userObject;
userObject = Users.findOne({
userId: voiceUserObject.web_userid,
});
if (userObject != null) {
if (voiceUserObject.talking != null) {
Users.update({
meetingId: meetingId,
userId: voiceUserObject.web_userid,
}, {
$set: {
'user.voiceUser.talking': voiceUserObject.talking,
},
}, (err, numChanged) => {
if (err != null) {
logger.error(`_unsucc update of voiceUser ${voiceUserObject.web_userid} [talking] err=${JSON.stringify(err)}`);
}
return callback();
});
} // talking
if (voiceUserObject.joined != null) {
Users.update({
meetingId: meetingId,
userId: voiceUserObject.web_userid,
}, {
$set: {
'user.voiceUser.joined': voiceUserObject.joined,
},
}, (err, numChanged) => {
if (err != null) {
logger.error(
`_unsucc update of voiceUser ${voiceUserObject.web_userid} [joined] err=${JSON.stringify(err)}`
);
}
return callback();
});
} // joined
if (voiceUserObject.locked != null) {
Users.update({
meetingId: meetingId,
userId: voiceUserObject.web_userid,
}, {
$set: {
'user.voiceUser.locked': voiceUserObject.locked,
},
}, (err, numChanged) => {
if (err != null) {
logger.error(`_unsucc update of voiceUser ${voiceUserObject.web_userid} [locked] err=${JSON.stringify(err)}`);
}
return callback();
});
} // locked
if (voiceUserObject.muted != null) {
Users.update({
meetingId: meetingId,
userId: voiceUserObject.web_userid,
}, {
$set: {
'user.voiceUser.muted': voiceUserObject.muted,
},
}, (err, numChanged) => {
if (err != null) {
logger.error(`_unsucc update of voiceUser ${voiceUserObject.web_userid} [muted] err=${JSON.stringify(err)}`);
}
return callback();
});
} // muted
if (voiceUserObject.listen_only != null) {
return Users.update({
meetingId: meetingId,
userId: voiceUserObject.web_userid,
}, {
$set: {
'user.listenOnly': voiceUserObject.listen_only,
},
}, (err, numChanged) => {
if (err != null) {
logger.error(`_unsucc update of voiceUser ${voiceUserObject.web_userid} [listenOnly] err=${JSON.stringify(err)}`);
}
return callback();
});
} // listenOnly
} else {
logger.error('ERROR! did not find such voiceUser!');
return callback();
}
};