2018-11-09 02:55:12 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import RedisPubSub from '/imports/startup/server/redis';
|
2020-02-07 04:47:28 +08:00
|
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
2021-05-05 20:58:17 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2018-11-09 02:55:12 +08:00
|
|
|
|
2020-02-07 04:47:28 +08:00
|
|
|
export default function toggleLockSettings(lockSettingsProps) {
|
2018-11-09 02:55:12 +08:00
|
|
|
const REDIS_CONFIG = Meteor.settings.private.redis;
|
|
|
|
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
|
|
|
const EVENT_NAME = 'ChangeLockSettingsInMeetingCmdMsg';
|
|
|
|
|
2021-05-05 20:58:17 +08:00
|
|
|
try {
|
|
|
|
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
2018-11-09 02:55:12 +08:00
|
|
|
|
2021-05-05 20:58:17 +08:00
|
|
|
check(meetingId, String);
|
|
|
|
check(requesterUserId, String);
|
|
|
|
check(lockSettingsProps, {
|
|
|
|
disableCam: Boolean,
|
|
|
|
disableMic: Boolean,
|
|
|
|
disablePrivateChat: Boolean,
|
|
|
|
disablePublicChat: Boolean,
|
2021-10-16 03:07:13 +08:00
|
|
|
disableNotes: Boolean,
|
2021-05-05 20:58:17 +08:00
|
|
|
hideUserList: Boolean,
|
|
|
|
lockOnJoin: Boolean,
|
|
|
|
lockOnJoinConfigurable: Boolean,
|
2022-03-22 02:25:41 +08:00
|
|
|
hideViewersCursor: Boolean,
|
2021-05-05 20:58:17 +08:00
|
|
|
setBy: Match.Maybe(String),
|
|
|
|
});
|
2019-09-09 22:21:54 +08:00
|
|
|
|
2021-05-05 20:58:17 +08:00
|
|
|
const {
|
|
|
|
disableCam,
|
|
|
|
disableMic,
|
|
|
|
disablePrivateChat: disablePrivChat,
|
|
|
|
disablePublicChat: disablePubChat,
|
2021-10-16 03:07:13 +08:00
|
|
|
disableNotes,
|
2021-05-05 20:58:17 +08:00
|
|
|
hideUserList,
|
|
|
|
lockOnJoin,
|
|
|
|
lockOnJoinConfigurable,
|
2022-03-22 02:25:41 +08:00
|
|
|
hideViewersCursor,
|
2021-05-05 20:58:17 +08:00
|
|
|
} = lockSettingsProps;
|
2018-11-09 02:55:12 +08:00
|
|
|
|
2021-05-05 20:58:17 +08:00
|
|
|
const payload = {
|
|
|
|
disableCam,
|
|
|
|
disableMic,
|
|
|
|
disablePrivChat,
|
|
|
|
disablePubChat,
|
2021-10-16 03:07:13 +08:00
|
|
|
disableNotes,
|
2021-05-05 20:58:17 +08:00
|
|
|
hideUserList,
|
|
|
|
lockOnJoin,
|
|
|
|
lockOnJoinConfigurable,
|
2022-03-22 02:25:41 +08:00
|
|
|
hideViewersCursor,
|
2021-05-05 20:58:17 +08:00
|
|
|
setBy: requesterUserId,
|
|
|
|
};
|
|
|
|
|
|
|
|
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Exception while invoking method toggleLockSettings ${err.stack}`);
|
|
|
|
}
|
2018-11-09 02:55:12 +08:00
|
|
|
}
|