bigbluebutton-Github/bigbluebutton-html5/imports/api/meetings/server/methods/clearRandomlySelectedUser.js

31 lines
886 B
JavaScript
Raw Normal View History

import Logger from '/imports/startup/server/logger';
import Meetings from '/imports/api/meetings';
import { extractCredentials } from '/imports/api/common/server/helpers';
import { check } from 'meteor/check';
export default async function clearRandomlySelectedUser() {
2021-05-05 20:58:17 +08:00
try {
const { meetingId, requesterUserId } = extractCredentials(this.userId);
2021-05-05 20:58:17 +08:00
check(meetingId, String);
check(requesterUserId, String);
2021-05-05 20:58:17 +08:00
const selector = {
meetingId,
};
2021-05-05 20:58:17 +08:00
const modifier = {
$set: {
randomlySelectedUser: [],
},
};
const numberAffected = await Meetings.updateAsync(selector, modifier);
if (numberAffected) {
Logger.info(`Cleared randomly selected user from meeting=${meetingId} by id=${requesterUserId}`);
}
} catch (err) {
2021-05-05 20:58:17 +08:00
Logger.error(`Exception while invoking method clearRandomlySelectedUser ${err.stack}`);
}
}