2022-04-14 21:59:54 +08:00
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
import updateSpeechLocale from '../modifiers/updateSpeechLocale';
|
|
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
|
|
|
|
2022-04-28 22:06:19 +08:00
|
|
|
const LANGUAGES = Meteor.settings.public.app.audioCaptions.language.available;
|
2022-04-14 21:59:54 +08:00
|
|
|
|
|
|
|
export default function setSpeechLocale(locale) {
|
|
|
|
try {
|
|
|
|
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
|
|
|
|
|
|
|
check(meetingId, String);
|
|
|
|
check(requesterUserId, String);
|
|
|
|
check(locale, String);
|
|
|
|
|
|
|
|
if (LANGUAGES.includes(locale) || locale === '') {
|
|
|
|
updateSpeechLocale(meetingId, requesterUserId, locale);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Exception while invoking method setSpeechLocale ${err.stack}`);
|
|
|
|
}
|
|
|
|
}
|