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';
|
|
|
|
|
2023-03-14 00:59:52 +08:00
|
|
|
export default async function changeLockSettings(meetingId, payload) {
|
2017-09-12 03:11:03 +08:00
|
|
|
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,
|
2022-12-13 07:26:03 +08:00
|
|
|
hideViewersAnnotation: 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,
|
2022-12-13 07:26:03 +08:00
|
|
|
hideViewersAnnotation,
|
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,
|
2022-12-13 07:26:03 +08:00
|
|
|
hideViewersAnnotation,
|
2019-04-10 21:44:34 +08:00
|
|
|
setBy,
|
|
|
|
},
|
2017-09-12 03:11:03 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-11-23 21:13:46 +08:00
|
|
|
try {
|
2023-07-04 20:50:53 +08:00
|
|
|
const { numberAffected } = await Meetings.upsertAsync(selector, modifier);
|
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
|
|
|
}
|