bigbluebutton-Github/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/clearSlidesPresentation.js

31 lines
891 B
JavaScript
Raw Normal View History

2017-06-29 03:05:50 +08:00
import Slides from '/imports/api/2.0/slides';
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
import clearShapesWhiteboard from '/imports/api/2.0/shapes/server/modifiers/clearShapesWhiteboard';
export default function clearSlidesPresentation(meetingId, presentationId) {
check(meetingId, String);
check(presentationId, String);
const selector = {
meetingId,
presentationId,
};
const whiteboardIds = Slides.find(selector).map(row => row.slide.id);
const cb = (err, numChanged) => {
if (err) {
return Logger.error(`Removing Slides from collection: ${err}`);
}
if (numChanged) {
whiteboardIds.forEach(whiteboardId => clearShapesWhiteboard(meetingId, whiteboardId));
return Logger.info(`Removed Slides where presentationId=${presentationId}`);
}
};
return Slides.remove(selector, cb);
}