2018-09-29 05:32:52 +08:00
|
|
|
import Meetings from '/imports/api/meetings';
|
|
|
|
import { check } from 'meteor/check';
|
2018-11-16 06:07:47 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2018-09-29 05:32:52 +08:00
|
|
|
|
2023-03-17 02:37:24 +08:00
|
|
|
export default async function changeMuteMeeting(meetingId, payload) {
|
2018-09-29 05:32:52 +08:00
|
|
|
check(meetingId, String);
|
|
|
|
check(payload, {
|
|
|
|
muted: Boolean,
|
|
|
|
mutedBy: String,
|
|
|
|
});
|
|
|
|
|
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
|
|
|
'voiceProp.muteOnStart': payload.muted,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-11-23 21:13:46 +08:00
|
|
|
try {
|
2023-03-17 02:37:24 +08:00
|
|
|
const { numberAffected } = await Meetings.upsertAsync(selector, modifier);
|
2018-11-16 06:07:47 +08:00
|
|
|
|
2020-11-23 21:13:46 +08:00
|
|
|
if (numberAffected) {
|
2018-11-16 06:07:47 +08:00
|
|
|
Logger.info(`Changed meeting mute status meeting=${meetingId}`);
|
|
|
|
}
|
2020-11-23 21:13:46 +08:00
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Changing meeting mute status meeting={${meetingId}} ${err}`);
|
|
|
|
}
|
2018-09-29 05:32:52 +08:00
|
|
|
}
|