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';
|
|
|
|
|
|
|
|
export default function toggleLockSettings(credentials, meeting) {
|
|
|
|
const REDIS_CONFIG = Meteor.settings.private.redis;
|
|
|
|
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
|
|
|
const EVENT_NAME = 'ChangeLockSettingsInMeetingCmdMsg';
|
|
|
|
|
|
|
|
const { meetingId, requesterUserId } = credentials;
|
|
|
|
|
|
|
|
check(meetingId, String);
|
|
|
|
check(requesterUserId, String);
|
2019-04-04 01:23:31 +08:00
|
|
|
check(meeting.lockSettingsProps, {
|
2018-11-22 00:39:34 +08:00
|
|
|
disableCam: Boolean,
|
|
|
|
disableMic: Boolean,
|
2019-04-10 21:44:34 +08:00
|
|
|
disablePrivateChat: Boolean,
|
|
|
|
disablePublicChat: Boolean,
|
2019-03-29 02:47:11 +08:00
|
|
|
disableNote: Boolean,
|
2018-11-22 00:39:34 +08:00
|
|
|
lockedLayout: Boolean,
|
|
|
|
lockOnJoin: Boolean,
|
|
|
|
lockOnJoinConfigurable: Boolean,
|
2019-02-04 23:56:07 +08:00
|
|
|
setBy: Match.Maybe(String),
|
2018-11-22 00:39:34 +08:00
|
|
|
});
|
2018-11-09 02:55:12 +08:00
|
|
|
|
|
|
|
const payload = {
|
2019-04-04 01:23:31 +08:00
|
|
|
disableCam: meeting.lockSettingsProps.disableCam,
|
|
|
|
disableMic: meeting.lockSettingsProps.disableMic,
|
2019-04-10 21:44:34 +08:00
|
|
|
disablePrivChat: meeting.lockSettingsProps.disablePrivateChat,
|
|
|
|
disablePubChat: meeting.lockSettingsProps.disablePublicChat,
|
2019-03-29 02:47:11 +08:00
|
|
|
disableNote: meeting.lockSettingsProps.disableNote,
|
2019-04-04 01:23:31 +08:00
|
|
|
lockedLayout: meeting.lockSettingsProps.lockedLayout,
|
|
|
|
lockOnJoin: meeting.lockSettingsProps.lockOnJoin,
|
|
|
|
lockOnJoinConfigurable: meeting.lockSettingsProps.lockOnJoinConfigurable,
|
2018-11-09 02:55:12 +08:00
|
|
|
setBy: requesterUserId,
|
|
|
|
};
|
|
|
|
|
|
|
|
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
|
|
|
}
|