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

39 lines
1.1 KiB
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';
2016-05-13 01:43:59 +08:00
2016-11-12 03:02:46 +08:00
export default function clearSlides(meetingId) {
2016-10-21 19:41:17 +08:00
if (meetingId) {
try {
const numberAffectedSlidePositions = SlidePositions.remove({ meetingId });
const numberAffected = Slides.remove({ meetingId });
if (numberAffectedSlidePositions) {
Logger.info(`Cleared SlidePositions (${meetingId})`);
}
if (numberAffected) {
Logger.info(`Cleared Slides (${meetingId})`);
}
} catch (err) {
Logger.error(`Error on cleaning Slides (${meetingId}). ${err}`);
}
} else {
try {
const numberAffectedSlidePositions = SlidePositions.remove({ meetingId });
2016-11-18 20:28:55 +08:00
const numberAffected = Slides.remove({ meetingId });
if (numberAffectedSlidePositions) {
Logger.info(`Cleared SlidePositions (${meetingId})`);
}
if (numberAffected) {
Logger.info('Cleared Slides (all)');
}
} catch (err) {
Logger.error(`Error on cleaning Slides (all). ${err}`);
}
}
2017-06-03 03:25:02 +08:00
}