2017-10-12 10:00:28 +08:00
|
|
|
import Captions from '/imports/api/captions';
|
2017-01-18 20:53:33 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
|
2023-03-09 22:05:50 +08:00
|
|
|
export default async function clearCaptions(meetingId) {
|
2017-01-18 20:53:33 +08:00
|
|
|
if (meetingId) {
|
2020-11-25 04:44:13 +08:00
|
|
|
try {
|
2023-03-09 22:05:50 +08:00
|
|
|
const numberAffected = await Captions.removeAsync({ meetingId });
|
2020-11-25 04:44:13 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Cleared Captions (${meetingId})`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Error on clearing captions (${meetingId}). ${err}`);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
try {
|
2023-03-09 22:05:50 +08:00
|
|
|
const numberAffected = await Captions.removeAsync({});
|
2017-01-18 20:53:33 +08:00
|
|
|
|
2020-11-25 04:44:13 +08:00
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info('Cleared Captions (all)');
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Error on clearing captions (all). ${err}`);
|
|
|
|
}
|
|
|
|
}
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|