2017-09-12 03:11:03 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2017-10-12 10:00:28 +08:00
|
|
|
import Meetings from '/imports/api/meetings';
|
2017-09-12 03:11:03 +08:00
|
|
|
import { check } from 'meteor/check';
|
|
|
|
|
|
|
|
export default function changeLockSettings(meetingId, payload) {
|
|
|
|
check(meetingId, String);
|
|
|
|
check(payload, {
|
|
|
|
disableCam: Boolean,
|
|
|
|
disableMic: Boolean,
|
|
|
|
disablePrivChat: Boolean,
|
|
|
|
disablePubChat: Boolean,
|
2019-03-29 02:47:11 +08:00
|
|
|
disableNote: Boolean,
|
2019-08-10 07:45:26 +08:00
|
|
|
hideUserList: Boolean,
|
2017-09-12 03:11:03 +08:00
|
|
|
lockedLayout: Boolean,
|
|
|
|
lockOnJoin: Boolean,
|
|
|
|
lockOnJoinConfigurable: Boolean,
|
2019-02-04 23:56:07 +08:00
|
|
|
setBy: Match.Maybe(String),
|
2017-09-12 03:11:03 +08:00
|
|
|
});
|
|
|
|
|
2019-04-10 21:44:34 +08:00
|
|
|
const {
|
|
|
|
disableCam,
|
|
|
|
disableMic,
|
|
|
|
disablePrivChat,
|
|
|
|
disablePubChat,
|
2019-03-30 02:22:52 +08:00
|
|
|
disableNote,
|
2019-08-10 07:45:26 +08:00
|
|
|
hideUserList,
|
2019-04-10 21:44:34 +08:00
|
|
|
lockedLayout,
|
|
|
|
lockOnJoin,
|
|
|
|
lockOnJoinConfigurable,
|
|
|
|
setBy,
|
|
|
|
} = payload;
|
|
|
|
|
2017-09-12 03:11:03 +08:00
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
2019-04-10 21:44:34 +08:00
|
|
|
lockSettingsProps: {
|
|
|
|
disableCam,
|
|
|
|
disableMic,
|
|
|
|
disablePrivateChat: disablePrivChat,
|
|
|
|
disablePublicChat: disablePubChat,
|
2019-03-30 02:22:52 +08:00
|
|
|
disableNote,
|
2019-08-10 07:45:26 +08:00
|
|
|
hideUserList,
|
2019-04-10 21:44:34 +08:00
|
|
|
lockedLayout,
|
|
|
|
lockOnJoin,
|
|
|
|
lockOnJoinConfigurable,
|
|
|
|
setBy,
|
|
|
|
},
|
2017-09-12 03:11:03 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2017-09-18 09:58:37 +08:00
|
|
|
|
2020-11-23 21:13:46 +08:00
|
|
|
try {
|
|
|
|
const { numberAffected } = Meetings.upsert(selector, modifier);
|
2017-09-21 05:05:17 +08:00
|
|
|
|
2020-11-23 21:13:46 +08:00
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Changed meeting={${meetingId}} updated lock settings`);
|
|
|
|
} else {
|
|
|
|
Logger.info(`meeting={${meetingId}} lock settings were not updated`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Changing meeting={${meetingId}} lock settings: ${err}`);
|
|
|
|
}
|
2017-09-12 03:11:03 +08:00
|
|
|
}
|