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

31 lines
917 B
JavaScript
Raw Normal View History

import { Slides, SlidePositions } from '/imports/api/slides';
2016-10-21 19:41:17 +08:00
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
import clearAnnotations from '/imports/api/annotations/server/modifiers/clearAnnotations';
2016-10-21 19:41:17 +08:00
2016-11-12 03:02:46 +08:00
export default function clearSlidesPresentation(meetingId, presentationId) {
check(meetingId, String);
2016-10-21 19:41:17 +08:00
check(presentationId, String);
const selector = {
2016-11-12 03:02:46 +08:00
meetingId,
2016-10-21 19:41:17 +08:00
presentationId,
};
const whiteboardIds = Slides.find(selector, { fields: { id: 1 } }).map(row => row.id);
try {
SlidePositions.remove(selector);
const numberAffected = Slides.remove(selector);
2016-10-21 19:41:17 +08:00
if (numberAffected) {
whiteboardIds.forEach(whiteboardId => clearAnnotations(meetingId, whiteboardId));
Logger.info(`Removed Slides where presentationId=${presentationId}`);
}
} catch (err) {
Logger.error(`Removing Slides from collection: ${err}`);
}
2017-06-03 03:25:02 +08:00
}