diff --git a/bigbluebutton-html5/imports/api/audio-captions/index.js b/bigbluebutton-html5/imports/api/audio-captions/index.js index c16a82efc8..cf10470261 100644 --- a/bigbluebutton-html5/imports/api/audio-captions/index.js +++ b/bigbluebutton-html5/imports/api/audio-captions/index.js @@ -3,7 +3,7 @@ import { Meteor } from 'meteor/meteor'; const AudioCaptions = new Mongo.Collection('audio-captions'); if (Meteor.isServer) { - AudioCaptions._ensureIndex({ meetingId: 1 }); + AudioCaptions.createIndexAsync({ meetingId: 1 }); } export default AudioCaptions; diff --git a/bigbluebutton-html5/imports/api/audio-captions/server/handlers/transcriptUpdated.js b/bigbluebutton-html5/imports/api/audio-captions/server/handlers/transcriptUpdated.js index ff868dbf1c..d8e66c6cfc 100644 --- a/bigbluebutton-html5/imports/api/audio-captions/server/handlers/transcriptUpdated.js +++ b/bigbluebutton-html5/imports/api/audio-captions/server/handlers/transcriptUpdated.js @@ -1,6 +1,6 @@ import setTranscript from '/imports/api/audio-captions/server/modifiers/setTranscript'; -export default function transcriptUpdated({ header, body }) { +export default async function transcriptUpdated({ header, body }) { const { meetingId } = header; const { @@ -8,5 +8,5 @@ export default function transcriptUpdated({ header, body }) { transcript, } = body; - setTranscript(meetingId, transcriptId, transcript); + await setTranscript(meetingId, transcriptId, transcript); } diff --git a/bigbluebutton-html5/imports/api/audio-captions/server/modifiers/clearAudioCaptions.js b/bigbluebutton-html5/imports/api/audio-captions/server/modifiers/clearAudioCaptions.js index 06e8164f1b..cd97c33f14 100644 --- a/bigbluebutton-html5/imports/api/audio-captions/server/modifiers/clearAudioCaptions.js +++ b/bigbluebutton-html5/imports/api/audio-captions/server/modifiers/clearAudioCaptions.js @@ -1,10 +1,10 @@ import AudioCaptions from '/imports/api/audio-captions'; import Logger from '/imports/startup/server/logger'; -export default function clearAudioCaptions(meetingId) { +export default async function clearAudioCaptions(meetingId) { if (meetingId) { try { - const numberAffected = AudioCaptions.remove({ meetingId }); + const numberAffected = await AudioCaptions.removeAsync({ meetingId }); if (numberAffected) { Logger.info(`Cleared AudioCaptions (${meetingId})`); @@ -14,7 +14,7 @@ export default function clearAudioCaptions(meetingId) { } } else { try { - const numberAffected = AudioCaptions.remove({}); + const numberAffected = await AudioCaptions.removeAsync({}); if (numberAffected) { Logger.info('Cleared AudioCaptions (all)'); diff --git a/bigbluebutton-html5/imports/api/audio-captions/server/modifiers/setTranscript.js b/bigbluebutton-html5/imports/api/audio-captions/server/modifiers/setTranscript.js index 8b641629ee..d5ef7b7973 100644 --- a/bigbluebutton-html5/imports/api/audio-captions/server/modifiers/setTranscript.js +++ b/bigbluebutton-html5/imports/api/audio-captions/server/modifiers/setTranscript.js @@ -2,7 +2,7 @@ import { check } from 'meteor/check'; import AudioCaptions from '/imports/api/audio-captions'; import Logger from '/imports/startup/server/logger'; -export default function setTranscript(meetingId, transcriptId, transcript) { +export default async function setTranscript(meetingId, transcriptId, transcript) { try { check(meetingId, String); check(transcriptId, String); @@ -17,7 +17,7 @@ export default function setTranscript(meetingId, transcriptId, transcript) { }, }; - const numberAffected = AudioCaptions.upsert(selector, modifier); + const numberAffected = await AudioCaptions.upsertAsync(selector, modifier); if (numberAffected) { Logger.debug(`Set transcriptId=${transcriptId} transcript=${transcript} meeting=${meetingId}`); diff --git a/bigbluebutton-html5/imports/api/audio-captions/server/publishers.js b/bigbluebutton-html5/imports/api/audio-captions/server/publishers.js index 25a64c79c0..17d4632fea 100644 --- a/bigbluebutton-html5/imports/api/audio-captions/server/publishers.js +++ b/bigbluebutton-html5/imports/api/audio-captions/server/publishers.js @@ -3,8 +3,9 @@ import { Meteor } from 'meteor/meteor'; import Logger from '/imports/startup/server/logger'; import AuthTokenValidation, { ValidationStates } from '/imports/api/auth-token-validation'; -function audioCaptions() { - const tokenValidation = AuthTokenValidation.findOne({ connectionId: this.connection.id }); +async function audioCaptions() { + const tokenValidation = await AuthTokenValidation + .findOneAsync({ connectionId: this.connection.id }); if (!tokenValidation || tokenValidation.validationStatus !== ValidationStates.VALIDATED) { Logger.warn(`Publishing AudioCaptions was requested by unauth connection ${this.connection.id}`);