bigbluebutton-Github/bigbluebutton-html5/imports/api/presentations/server/modifiers/clearPresentations.js

43 lines
1.2 KiB
JavaScript
Raw Normal View History

import Presentations from '/imports/api/presentations';
2016-11-12 03:02:46 +08:00
import Logger from '/imports/startup/server/logger';
2018-04-06 04:56:41 +08:00
export default function clearPresentations(meetingId, podId) {
// clearing presentations for 1 pod
if (meetingId && podId) {
try {
const numberAffected = Presentations.remove({ meetingId, podId });
if (numberAffected) {
Logger.info(`Cleared Presentations (${meetingId}, ${podId})`);
return true;
}
} catch (err) {
Logger.error(`Error on cleaning Presentations (${meetingId}, ${podId}). ${err}`);
return false;
}
}
2018-04-06 04:56:41 +08:00
// clearing presentations for the whole meeting
if (meetingId) {
try {
const numberAffected = Presentations.remove({ meetingId });
2018-04-06 04:56:41 +08:00
if (numberAffected) {
Logger.info(`Cleared Presentations (${meetingId})`);
}
} catch (err) {
Logger.error(`Error on cleaning Presentations (${meetingId}). ${err}`);
}
} else {
try {
const numberAffected = Presentations.remove({});
if (numberAffected) {
Logger.info('Cleared Presentations (all)');
}
} catch (err) {
Logger.error(`Error on cleaning Presentations (all). ${err}`);
}
}
2017-06-03 03:25:02 +08:00
}