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

31 lines
742 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,
},
};
try {
const { numberAffected } = PresentationPods.upsert(selector, modifier);
2018-04-06 05:04:27 +08:00
if (numberAffected) {
2018-04-06 05:04:27 +08:00
Logger.info(`Set a new presenter in pod id=${podId} meeting=${meetingId}`);
}
} catch (err) {
Logger.error(`Setting a presenter in pod: ${err}`);
}
2018-04-06 05:04:27 +08:00
}