bigbluebutton-Github/bigbluebutton-html5/imports/api/voice-users/server/modifiers/changeMuteMeeting.js

32 lines
732 B
JavaScript
Raw Normal View History

2018-09-29 05:32:52 +08:00
import Meetings from '/imports/api/meetings';
import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
2018-09-29 05:32:52 +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,
},
};
try {
const { numberAffected } = await Meetings.upsertAsync(selector, modifier);
if (numberAffected) {
Logger.info(`Changed meeting mute status meeting=${meetingId}`);
}
} catch (err) {
Logger.error(`Changing meeting mute status meeting={${meetingId}} ${err}`);
}
2018-09-29 05:32:52 +08:00
}