bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/modifiers/changePresenter.js

27 lines
634 B
JavaScript
Raw Normal View History

import Logger from '/imports/startup/server/logger';
import Users from '/imports/api/users';
export default async function changePresenter(presenter, userId, meetingId, changedBy) {
const selector = {
meetingId,
userId,
};
const modifier = {
$set: {
presenter,
},
};
try {
const numberAffected = await Users.updateAsync(selector, modifier);
if (numberAffected) {
Logger.info(`Changed presenter=${presenter} id=${userId} meeting=${meetingId}`
+ `${changedBy ? ` changedBy=${changedBy}` : ''}`);
}
} catch (err) {
2021-06-22 02:16:01 +08:00
Logger.error(`Change presenter error: ${err}`);
}
}