2019-05-22 03:21:46 +08:00
|
|
|
import RedisPubSub from '/imports/startup/server/redis';
|
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
import { check } from 'meteor/check';
|
2021-10-16 03:07:13 +08:00
|
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
2019-05-22 03:21:46 +08:00
|
|
|
|
2021-10-16 03:07:13 +08:00
|
|
|
export default function updateCaptionsOwner(locale, name) {
|
2019-05-22 03:21:46 +08:00
|
|
|
const REDIS_CONFIG = Meteor.settings.private.redis;
|
|
|
|
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
|
|
|
const EVENT_NAME = 'UpdateCaptionOwnerPubMsg';
|
|
|
|
|
2021-05-05 01:34:31 +08:00
|
|
|
try {
|
2021-10-16 03:07:13 +08:00
|
|
|
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
|
|
|
|
2021-05-05 01:34:31 +08:00
|
|
|
check(meetingId, String);
|
2021-10-16 03:07:13 +08:00
|
|
|
check(requesterUserId, String);
|
2021-10-05 03:22:18 +08:00
|
|
|
check(locale, String);
|
2021-10-16 03:07:13 +08:00
|
|
|
check(name, String);
|
2019-05-22 03:21:46 +08:00
|
|
|
|
2021-05-05 01:34:31 +08:00
|
|
|
const payload = {
|
2021-10-16 03:07:13 +08:00
|
|
|
ownerId: requesterUserId,
|
|
|
|
locale,
|
|
|
|
name,
|
2021-05-05 01:34:31 +08:00
|
|
|
};
|
2019-05-22 03:21:46 +08:00
|
|
|
|
2021-10-16 03:07:13 +08:00
|
|
|
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
2021-05-05 01:34:31 +08:00
|
|
|
} catch (err) {
|
2021-10-16 03:07:13 +08:00
|
|
|
Logger.error(`Exception while invoking method updateCaptionsOwner ${err.stack}`);
|
2021-05-05 01:34:31 +08:00
|
|
|
}
|
2019-05-22 03:21:46 +08:00
|
|
|
}
|