bigbluebutton-Github/bigbluebutton-html5/imports/api/guest-users/server/modifiers/setGuestStatus.js
SashoVihVas d99c271fa6 This commit includes following changes:
1.HashMap updates in Meeting.java are updated
2.callback is removed from setGuestStatus.js
3.MeetingService.java passes the guest list instead of iterating through it
2022-01-20 18:24:25 +00:00

40 lines
1.1 KiB
JavaScript

import { check } from 'meteor/check';
import GuestUsers from '/imports/api/guest-users';
import Logger from '/imports/startup/server/logger';
import updatePositionInWaitingQueue from '../methods/updatePositionInWaitingQueue';
const GUEST_STATUS_ALLOW = 'ALLOW';
const GUEST_STATUS_DENY = 'DENY';
export default function setGuestStatus(meetingId, intId, status, approvedBy = null) {
check(meetingId, String);
check(intId, String);
check(status, String);
const selector = {
meetingId,
intId,
};
const modifier = {
$set: {
approved: status === GUEST_STATUS_ALLOW,
denied: status === GUEST_STATUS_DENY,
approvedBy,
},
};
try {
const numberAffected = GuestUsers.update(selector, modifier);
if (numberAffected) {
Logger.info(`Updated status=${status} user=${intId} meeting=${meetingId}`);
/** Update position of waiting users after user has been
* approved or denied by the moderator
*/
updatePositionInWaitingQueue(meetingId);
}
} catch (err) {
Logger.error(`Updating status=${status} user=${intId}: ${err}`);
}
}