2019-02-22 05:09:44 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import Users from '/imports/api/users';
|
|
|
|
import RedisPubSub from '/imports/startup/server/redis';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
|
|
|
|
export default function userActivitySign(credentials) {
|
|
|
|
const REDIS_CONFIG = Meteor.settings.private.redis;
|
|
|
|
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
|
|
|
const EVENT_NAME = 'UserActivitySignCmdMsg';
|
|
|
|
|
|
|
|
const { meetingId, requesterUserId: userId } = credentials;
|
|
|
|
|
|
|
|
check(meetingId, String);
|
|
|
|
check(userId, String);
|
|
|
|
|
|
|
|
const payload = {
|
|
|
|
userId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const selector = {
|
|
|
|
userId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
|
|
|
inactivityCheck: false,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
Users.update(selector, modifier);
|
|
|
|
|
2019-02-27 01:40:01 +08:00
|
|
|
Logger.info(`User ${userId} sent a activity sign for meeting ${meetingId}`);
|
2019-02-22 05:09:44 +08:00
|
|
|
|
|
|
|
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, userId, payload);
|
|
|
|
}
|