bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/methods/setExitReason.js
2023-03-20 16:35:52 -03:00

22 lines
758 B
JavaScript

import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import { extractCredentials } from '/imports/api/common/server/helpers';
import setUserExitReason from '/imports/api/users/server/modifiers/setUserExitReason';
export default async function setExitReason(reason) {
try {
const { meetingId, requesterUserId } = extractCredentials(this.userId);
// Unauthenticated user, just ignore and go ahead.
if (!meetingId || !requesterUserId) return;
check(meetingId, String);
check(requesterUserId, String);
check(reason, String);
await setUserExitReason(meetingId, requesterUserId, reason);
} catch (err) {
Logger.error(`Exception while invoking method setExitReason ${err.stack}`);
}
}