bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/handlers/emojiStatus.js

40 lines
893 B
JavaScript
Raw Normal View History

2017-02-23 02:59:47 +08:00
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
import Users from '/imports/api/users';
export default function handleEmojiStatus({ payload }) {
const meetingId = payload.meeting_id;
const userId = payload.userid;
const status = payload.emoji_status;
check(meetingId, String);
check(userId, String);
check(status, String);
const selector = {
meetingId,
userId,
};
const modifier = {
$set: {
'user.set_emoji_time': (new Date()).getTime(),
2017-02-23 02:59:47 +08:00
'user.emoji_status': status,
},
};
const cb = (err, numChanged) => {
if (err) {
return Logger.error(`Assigning user emoji status: ${err}`);
}
if (numChanged) {
2017-06-03 03:25:02 +08:00
return Logger.info(`Assigned user emoji status${
status} id=${userId} meeting=${meetingId}`,
);
2017-02-23 02:59:47 +08:00
}
};
return Users.update(selector, modifier, cb);
2017-06-03 03:25:02 +08:00
}