bigbluebutton-Github/bigbluebutton-html5/imports/api/presentation-pods/server/modifiers/setPresenterInPod.js

34 lines
769 B
JavaScript
Raw Normal View History

2018-04-06 05:04:27 +08:00
import { check } from 'meteor/check';
2018-04-06 06:00:52 +08:00
import PresentationPods from '/imports/api/presentation-pods';
2018-04-06 05:04:27 +08:00
import Logger from '/imports/startup/server/logger';
export default function setPresenterInPod(meetingId, podId, nextPresenterId) {
check(meetingId, String);
check(podId, String);
check(nextPresenterId, String);
const selector = {
meetingId,
podId,
};
const modifier = {
$set: {
currentPresenterId: nextPresenterId,
},
};
const cb = (err, numChanged) => {
if (err) {
Logger.error(`Setting a presenter in pod: ${err}`);
return;
}
if (numChanged) {
Logger.info(`Set a new presenter in pod id=${podId} meeting=${meetingId}`);
}
};
return PresentationPods.upsert(selector, modifier, cb);
}