bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/methods/userActivitySign.js

41 lines
1.2 KiB
JavaScript
Raw Normal View History

import { Meteor } from 'meteor/meteor';
import Users from '/imports/api/users';
import RedisPubSub from '/imports/startup/server/redis';
import Logger from '/imports/startup/server/logger';
import { extractCredentials } from '/imports/api/common/server/helpers';
import { check } from 'meteor/check';
export default function userActivitySign() {
2021-05-06 00:47:43 +08:00
try {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'UserActivitySignCmdMsg';
const { meetingId, requesterUserId: userId } = extractCredentials(this.userId);
2021-05-06 00:47:43 +08:00
check(meetingId, String);
check(userId, String);
2021-05-06 00:47:43 +08:00
const payload = {
userId,
};
2021-05-06 00:47:43 +08:00
const selector = {
userId,
};
2021-05-06 00:47:43 +08:00
const modifier = {
$set: {
inactivityCheck: false,
},
};
2021-05-06 00:47:43 +08:00
Users.update(selector, modifier); // TODO-- we should move this to a modifier
2021-05-06 00:47:43 +08:00
Logger.info(`User ${userId} sent a activity sign for meeting ${meetingId}`);
2021-05-06 00:47:43 +08:00
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, userId, payload);
} catch (err) {
Logger.error(`Exception while invoking method userActivitySign ${err.stack}`);
}
}