bigbluebutton-Github/bigbluebutton-html5/imports/api/breakouts/server/modifiers/clearBreakouts.js

30 lines
724 B
JavaScript
Raw Normal View History

2016-11-14 19:57:10 +08:00
import Logger from '/imports/startup/server/logger';
import Breakouts from '/imports/api/breakouts';
2016-11-14 19:57:10 +08:00
export default function clearBreakouts(breakoutId) {
if (breakoutId) {
2016-11-25 03:22:04 +08:00
const selector = {
breakoutId,
2016-11-25 03:22:04 +08:00
};
try {
const numberAffected = Breakouts.remove(selector);
if (numberAffected) {
Logger.info(`Cleared Breakouts (${breakoutId})`);
}
} catch (err) {
Logger.error(`Error on clearing Breakouts (${breakoutId})`);
}
} else {
try {
const numberAffected = Breakouts.remove({});
if (numberAffected) {
Logger.info('Cleared Breakouts (all)');
}
} catch (err) {
Logger.error('Error on clearing Breakouts (all)');
}
}
2016-11-14 19:57:10 +08:00
}