bigbluebutton-Github/bigbluebutton-html5/imports/api/captions/server/methods/stopDictation.js
2023-03-20 16:23:41 -03:00

26 lines
810 B
JavaScript

import { check } from 'meteor/check';
import Captions from '/imports/api/captions';
import { extractCredentials } from '/imports/api/common/server/helpers';
import Logger from '/imports/startup/server/logger';
import setDictation from '/imports/api/captions/server/modifiers/setDictation';
export default async function stopDictation(locale) {
try {
const { meetingId, requesterUserId } = extractCredentials(this.userId);
check(meetingId, String);
check(requesterUserId, String);
check(locale, String);
const captions = await Captions.findOne({
meetingId,
ownerId: requesterUserId,
locale,
});
if (captions) await setDictation(meetingId, locale, false);
} catch (err) {
Logger.error(`Exception while invoking method stopDictation ${err.stack}`);
}
}