bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/modifiers/userInactivityInspect.js
2019-02-26 14:40:01 -03:00

35 lines
740 B
JavaScript

import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import Users from '/imports/api/users';
export default function userInactivityInspect(userId, responseDelay) {
check(userId, String);
check(responseDelay, Match.Integer);
const selector = {
userId,
inactivityCheck: false,
};
const modifier = {
$set: {
inactivityCheck: true,
responseDelay,
},
};
const cb = (err, numChanged) => {
if (err) {
return Logger.error(`Inactivity check for user ${userId}: ${err}`);
}
if (numChanged) {
return Logger.info(`Updated user ${userId} with inactivity inspect`);
}
return null;
};
return Users.update(selector, modifier, cb);
}