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';
|
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';
|
2020-02-07 04:47:28 +08:00
|
|
|
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
2018-11-09 02:55:12 +08:00
|
|
|
|
2019-09-09 22:21:54 +08:00
|
|
|
check(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,
|
2019-08-10 07:45:26 +08:00
|
|
|
hideUserList: 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
|
|
|
|
2019-09-09 22:21:54 +08:00
|
|
|
const {
|
|
|
|
disableCam,
|
|
|
|
disableMic,
|
|
|
|
disablePrivateChat: disablePrivChat,
|
|
|
|
disablePublicChat: disablePubChat,
|
|
|
|
disableNote,
|
|
|
|
hideUserList,
|
|
|
|
lockedLayout,
|
|
|
|
lockOnJoin,
|
|
|
|
lockOnJoinConfigurable,
|
|
|
|
} = lockSettingsProps;
|
|
|
|
|
2018-11-09 02:55:12 +08:00
|
|
|
const payload = {
|
2019-09-09 22:21:54 +08:00
|
|
|
disableCam,
|
|
|
|
disableMic,
|
|
|
|
disablePrivChat,
|
|
|
|
disablePubChat,
|
|
|
|
disableNote,
|
|
|
|
hideUserList,
|
|
|
|
lockedLayout,
|
|
|
|
lockOnJoin,
|
|
|
|
lockOnJoinConfigurable,
|
2018-11-09 02:55:12 +08:00
|
|
|
setBy: requesterUserId,
|
|
|
|
};
|
|
|
|
|
|
|
|
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
|
|
|
}
|