bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/modifiers/clearUsersEmoji.js
2023-06-07 22:10:07 -03:00

36 lines
858 B
JavaScript

import Users from '/imports/api/users';
import Logger from '/imports/startup/server/logger';
export default function clearUsersEmoji(meetingId) {
const selector = {};
if (meetingId) {
selector.meetingId = meetingId;
}
try {
const numberAffected = Users.update(selector, {
$set: {
emojiTime: (new Date()).getTime(),
emoji: 'none',
awayTime: 0,
away: false,
raiseHandTime: 0,
raiseHand: false,
},
}, { multi: true });
if (numberAffected) {
if (meetingId) {
Logger.info(`Removed users emoji status (${meetingId})`);
} else {
Logger.info('Removed users emoji status (all)');
}
} else {
Logger.warn('Removing users emoji status nonaffected');
}
} catch (err) {
Logger.error(`Removing users emoji stautus: ${err}`);
}
}