bigbluebutton-Github/bigbluebutton-html5/imports/api/captions/server/methods/updateOwner.js

32 lines
941 B
JavaScript
Raw Normal View History

import RedisPubSub from '/imports/startup/server/redis';
import Captions from '/imports/api/captions';
import Logger from '/imports/startup/server/logger';
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
export default function editCaptions(meetingId, userId, padId) { // TODO
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'UpdateCaptionOwnerPubMsg';
check(meetingId, String);
check(userId, String);
check(padId, String);
2019-05-29 22:31:27 +08:00
const pad = Captions.findOne({ meetingId, padId });
if (!pad) return Logger.error(`Editing captions owner: ${padId}`);
const { locale } = pad;
check(locale, { locale: String, name: String });
const payload = {
ownerId: userId,
locale: locale.name,
localeCode: locale.locale,
};
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, userId, payload);
}