handle UserEjectedFromMeetingEvtMsg
This commit is contained in:
parent
17b4beb545
commit
8418317e03
@ -7,6 +7,7 @@ import handleEmojiStatus from './handlers/emojiStatus';
|
||||
import handleGetUsers from './handlers/getUsers';
|
||||
import handleGuestsWaitingForApproval from './handlers/guestsWaitingForApproval';
|
||||
import handleGuestApproved from './handlers/guestApproved';
|
||||
import handleKickUser from './handlers/kickUser';
|
||||
|
||||
RedisPubSub.on('PresenterAssignedEvtMsg', handlePresenterAssigned);
|
||||
RedisPubSub.on('UserJoinedMeetingEvtMsg', handleUserJoined);
|
||||
@ -16,3 +17,4 @@ RedisPubSub.on('UserEmojiChangedEvtMsg', handleEmojiStatus);
|
||||
RedisPubSub.on('SyncGetUsersMeetingRespMsg', handleGetUsers);
|
||||
RedisPubSub.on('GuestsWaitingForApprovalEvtMsg', handleGuestsWaitingForApproval);
|
||||
RedisPubSub.on('GuestApprovedEvtMsg', handleGuestApproved);
|
||||
RedisPubSub.on('UserEjectedFromMeetingEvtMsg', handleKickUser);
|
||||
|
@ -0,0 +1,8 @@
|
||||
import kickUser from '../modifiers/kickUser';
|
||||
|
||||
export default function handleKickUser({ header }) {
|
||||
const meetingId = header.meetingId;
|
||||
const userId = header.userId;
|
||||
|
||||
return kickUser(meetingId, userId);
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Users from './../../';
|
||||
|
||||
export default function kickUser(meetingId, userId) {
|
||||
check(meetingId, String);
|
||||
check(userId, String);
|
||||
|
||||
const selector = {
|
||||
meetingId,
|
||||
userId,
|
||||
};
|
||||
|
||||
const modifier = {
|
||||
$set: {
|
||||
'user.kicked': true,
|
||||
'user.connection_status': 'offline',
|
||||
'user.voiceUser.talking': false,
|
||||
'user.voiceUser.joined': false,
|
||||
'user.voiceUser.muted': false,
|
||||
'user.time_of_joining': 0,
|
||||
'user.listenOnly': false,
|
||||
},
|
||||
};
|
||||
|
||||
const cb = (err, numChanged) => {
|
||||
if (err) {
|
||||
return Logger.error(`Kicking user from collection: ${err}`);
|
||||
}
|
||||
|
||||
if (numChanged) {
|
||||
return Logger.info(`Kicked user id=${userId} meeting=${meetingId}`);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
return Users.update(selector, modifier, cb);
|
||||
}
|
Loading…
Reference in New Issue
Block a user