bigbluebutton-Github/bigbluebutton-html5/imports/api/2.0/users/server/handlers/emojiStatus.js
Oleksandr Zhurbenko 251bd22738 PR review fixes
2017-09-06 12:36:52 -07:00

37 lines
763 B
JavaScript

import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
import Users from '/imports/api/2.0/users';
export default function handleEmojiStatus({ body }, meetingId) {
const { userId, emoji } = body;
check(userId, String);
check(emoji, String);
const selector = {
meetingId,
userId,
};
const modifier = {
$set: {
emojiTime: (new Date()).getTime(),
emoji,
},
};
const cb = (err, numChanged) => {
if (err) {
return Logger.error(`Assigning user emoji status: ${err}`);
}
if (numChanged) {
return Logger.info(`Assigned user emoji status${
emoji} id=${userId} meeting=${meetingId}`,
);
}
};
return Users.update(selector, modifier, cb);
}