bigbluebutton-Github/bigbluebutton-html5/imports/api/captions/server/modifiers/updateCaptionsOwner.js

34 lines
879 B
JavaScript
Raw Normal View History

import { check } from 'meteor/check';
import Captions from '/imports/api/captions';
import Logger from '/imports/startup/server/logger';
export default async function updateCaptionsOwner(meetingId, locale, ownerId) {
try {
check(meetingId, String);
check(locale, String);
check(ownerId, String);
const selector = {
meetingId,
locale,
};
const modifier = {
$set: {
ownerId,
dictating: false, // Refresh dictation mode
},
};
const numberAffected = await Captions.upsert(selector, modifier);
if (numberAffected) {
Logger.info(`Added captions=${locale} owner=${ownerId} meeting=${meetingId}`);
} else {
Logger.info(`Upserted captions=${locale} owner=${ownerId} meeting=${meetingId}`);
}
} catch (err) {
Logger.error(`Adding captions owner to the collection: ${err}`);
}
}