bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/modifiers/changePresenter.js
2021-06-21 15:16:01 -03:00

27 lines
617 B
JavaScript
Executable File

import Logger from '/imports/startup/server/logger';
import Users from '/imports/api/users';
export default function changePresenter(presenter, userId, meetingId, changedBy) {
const selector = {
meetingId,
userId,
};
const modifier = {
$set: {
presenter,
},
};
try {
const numberAffected = Users.update(selector, modifier);
if (numberAffected) {
Logger.info(`Changed presenter=${presenter} id=${userId} meeting=${meetingId}`
+ `${changedBy ? ` changedBy=${changedBy}` : ''}`);
}
} catch (err) {
Logger.error(`Change presenter error: ${err}`);
}
}