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
|
|
|
|
|
|
|
export default function changeMuteMeeting(meetingId, payload) {
|
|
|
|
check(meetingId, String);
|
|
|
|
check(payload, {
|
|
|
|
muted: Boolean,
|
|
|
|
mutedBy: String,
|
|
|
|
});
|
|
|
|
|
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
|
|
|
'voiceProp.muteOnStart': payload.muted,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2018-11-16 06:07:47 +08:00
|
|
|
const cb = (err, numChanged) => {
|
|
|
|
if (err) {
|
|
|
|
Logger.error(`Changing meeting mute status meeting={${meetingId}} ${err}`);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (numChanged) {
|
|
|
|
Logger.info(`Changed meeting mute status meeting=${meetingId}`);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return Meetings.upsert(selector, modifier, cb);
|
2018-09-29 05:32:52 +08:00
|
|
|
}
|