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,
|
2021-10-16 03:07:13 +08:00
|
|
|
disableNotes: Boolean,
|
2019-08-10 07:45:26 +08:00
|
|
|
hideUserList: Boolean,
|
2017-09-12 03:11:03 +08:00
|
|
|
lockOnJoin: Boolean,
|
|
|
|
lockOnJoinConfigurable: Boolean,
|
2022-03-22 02:25:41 +08:00
|
|
|
hideViewersCursor: 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,
|
2021-10-16 03:07:13 +08:00
|
|
|
disableNotes,
|
2019-08-10 07:45:26 +08:00
|
|
|
hideUserList,
|
2019-04-10 21:44:34 +08:00
|
|
|
lockOnJoin,
|
|
|
|
lockOnJoinConfigurable,
|
2022-03-22 02:25:41 +08:00
|
|
|
hideViewersCursor,
|
2019-04-10 21:44:34 +08:00
|
|
|
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,
|
2021-10-16 03:07:13 +08:00
|
|
|
disableNotes,
|
2019-08-10 07:45:26 +08:00
|
|
|
hideUserList,
|
2019-04-10 21:44:34 +08:00
|
|
|
lockOnJoin,
|
|
|
|
lockOnJoinConfigurable,
|
2022-03-22 02:25:41 +08:00
|
|
|
hideViewersCursor,
|
2019-04-10 21:44:34 +08:00
|
|
|
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
|
|
|
}
|