Add userLeftFlag message
This commit is contained in:
parent
35ddbed8c2
commit
9c844bdd26
@ -6,6 +6,7 @@ import org.bigbluebutton.core.apps.voice.UserJoinedVoiceConfEvtMsgHdlr
|
||||
import org.bigbluebutton.core.domain.MeetingState2x
|
||||
import org.bigbluebutton.core.models.Users2x
|
||||
import org.bigbluebutton.core.running.{ HandlerHelpers, LiveMeeting, MeetingActor, OutMsgRouter }
|
||||
import org.bigbluebutton.core2.message.senders.MsgBuilder
|
||||
|
||||
trait UserJoinMeetingAfterReconnectReqMsgHdlr extends HandlerHelpers with UserJoinedVoiceConfEvtMsgHdlr {
|
||||
this: MeetingActor =>
|
||||
@ -15,12 +16,18 @@ trait UserJoinMeetingAfterReconnectReqMsgHdlr extends HandlerHelpers with UserJo
|
||||
|
||||
def handleUserJoinMeetingAfterReconnectReqMsg(msg: UserJoinMeetingAfterReconnectReqMsg, state: MeetingState2x): MeetingState2x = {
|
||||
log.info("Received user joined after reconnecting. user {} meetingId={}", msg.body.userId, msg.header.meetingId)
|
||||
|
||||
Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId) match {
|
||||
case Some(reconnectingUser) =>
|
||||
if (reconnectingUser.userLeftFlag.left) {
|
||||
log.info("Resetting flag that user left meeting. user {}", msg.body.userId)
|
||||
// User has reconnected. Just reset it's flag. ralam Oct 23, 2018
|
||||
println(Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId))
|
||||
for {
|
||||
u <- Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId)
|
||||
} yield {
|
||||
val userLeftFlagMeetingEvent = MsgBuilder.buildUserLeftFlagEvtMsg(liveMeeting.props.meetingProp.intId, u.intId, false)
|
||||
outGW.send(userLeftFlagMeetingEvent)
|
||||
}
|
||||
Users2x.resetUserLeftFlag(liveMeeting.users2x, msg.body.userId)
|
||||
}
|
||||
state
|
||||
|
@ -5,6 +5,7 @@ import org.bigbluebutton.core.apps.breakout.BreakoutHdlrHelpers
|
||||
import org.bigbluebutton.core.models.{ Users2x, VoiceUsers }
|
||||
import org.bigbluebutton.core.domain.MeetingState2x
|
||||
import org.bigbluebutton.core.running.{ HandlerHelpers, LiveMeeting, MeetingActor, OutMsgRouter }
|
||||
import org.bigbluebutton.core2.message.senders.MsgBuilder
|
||||
|
||||
trait UserJoinMeetingReqMsgHdlr extends HandlerHelpers {
|
||||
this: MeetingActor =>
|
||||
@ -20,6 +21,12 @@ trait UserJoinMeetingReqMsgHdlr extends HandlerHelpers {
|
||||
if (reconnectingUser.userLeftFlag.left) {
|
||||
log.info("Resetting flag that user left meeting. user {}", msg.body.userId)
|
||||
// User has reconnected. Just reset it's flag. ralam Oct 23, 2018
|
||||
for {
|
||||
u <- Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId)
|
||||
} yield {
|
||||
val userLeftFlagMeetingEvent = MsgBuilder.buildUserLeftFlagEvtMsg(liveMeeting.props.meetingProp.intId, u.intId, false)
|
||||
outGW.send(userLeftFlagMeetingEvent)
|
||||
}
|
||||
Users2x.resetUserLeftFlag(liveMeeting.users2x, msg.body.userId)
|
||||
}
|
||||
state
|
||||
|
@ -4,6 +4,7 @@ import org.bigbluebutton.common2.msgs.UserLeaveReqMsg
|
||||
import org.bigbluebutton.core.domain.MeetingState2x
|
||||
import org.bigbluebutton.core.models.{ RegisteredUsers, Users2x }
|
||||
import org.bigbluebutton.core.running.{ MeetingActor, OutMsgRouter }
|
||||
import org.bigbluebutton.core2.message.senders.MsgBuilder
|
||||
|
||||
trait UserLeaveReqMsgHdlr {
|
||||
this: MeetingActor =>
|
||||
@ -19,6 +20,12 @@ trait UserLeaveReqMsgHdlr {
|
||||
// Just flag that user has left as the user might be reconnecting.
|
||||
// An audit will remove this user if it hasn't rejoined after a certain period of time.
|
||||
// ralam oct 23, 2018
|
||||
for {
|
||||
u <- Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId)
|
||||
} yield {
|
||||
val userLeftFlagMeetingEvent = MsgBuilder.buildUserLeftFlagEvtMsg(liveMeeting.props.meetingProp.intId, u.intId, true)
|
||||
outGW.send(userLeftFlagMeetingEvent)
|
||||
}
|
||||
Users2x.setUserLeftFlag(liveMeeting.users2x, msg.body.userId)
|
||||
}
|
||||
if (msg.body.loggedOut) {
|
||||
|
@ -34,8 +34,6 @@ object Users2x {
|
||||
} yield {
|
||||
val newUser = u.copy(userLeftFlag = UserLeftFlag(true, System.currentTimeMillis()))
|
||||
users.save(newUser)
|
||||
val userLeftMeetingEvent = MsgBuilder.buildUserLeftMeetingEvtMsg(, u.intId)
|
||||
outGW.send(userLeftMeetingEvent)
|
||||
newUser
|
||||
}
|
||||
}
|
||||
|
@ -25,10 +25,10 @@ export default function addUserPersistentData(user) {
|
||||
locked: Boolean,
|
||||
avatar: String,
|
||||
clientType: String,
|
||||
left: Boolean,
|
||||
effectiveConnectionType: null,
|
||||
});
|
||||
|
||||
|
||||
const {
|
||||
intId,
|
||||
extId,
|
||||
|
@ -1,6 +1,7 @@
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import handleRemoveUser from './handlers/removeUser';
|
||||
import handleUserJoined from './handlers/userJoined';
|
||||
import handleUserLeftFlag from './handlers/userLeftFlag';
|
||||
import handleValidateAuthToken from './handlers/validateAuthToken';
|
||||
import handlePresenterAssigned from './handlers/presenterAssigned';
|
||||
import handleEmojiStatus from './handlers/emojiStatus';
|
||||
@ -15,4 +16,5 @@ RedisPubSub.on('ValidateAuthTokenRespMsg', handleValidateAuthToken);
|
||||
RedisPubSub.on('UserEmojiChangedEvtMsg', handleEmojiStatus);
|
||||
RedisPubSub.on('UserEjectedFromMeetingEvtMsg', handleUserEjected);
|
||||
RedisPubSub.on('UserRoleChangedEvtMsg', handleChangeRole);
|
||||
RedisPubSub.on('UserLeftFlagEvtMsg', handleUserLeftFlag);
|
||||
RedisPubSub.on('UserInactivityInspectMsg', handleUserInactivityInspect);
|
||||
|
@ -0,0 +1,10 @@
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
import userLeftFlag from '../modifiers/userLeftFlag';
|
||||
|
||||
export default function handleUserLeftFlag({ body }, meetingId) {
|
||||
const user = body;
|
||||
check(user, Object);
|
||||
|
||||
userLeftFlag(meetingId, user.intId, user.userLeftFlag);
|
||||
}
|
@ -61,6 +61,7 @@ export default function addUser(meetingId, userData) {
|
||||
inactivityCheck: false,
|
||||
responseDelay: 0,
|
||||
loggedOut: false,
|
||||
left: false,
|
||||
...flat(user),
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,24 @@
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Users from '/imports/api/users';
|
||||
|
||||
export default function userLeftFlag(meetingId, userId, left) {
|
||||
const selector = {
|
||||
meetingId,
|
||||
userId,
|
||||
};
|
||||
|
||||
const modifier = {
|
||||
$set: {
|
||||
left,
|
||||
},
|
||||
};
|
||||
|
||||
try {
|
||||
const numberAffected = Users.update(selector, modifier);
|
||||
if (numberAffected) {
|
||||
Logger.info(`Updated user ${userId} with left flag as ${left}`);
|
||||
}
|
||||
} catch (err) {
|
||||
Logger.error(`Changed user role: ${err}`);
|
||||
}
|
||||
}
|
@ -59,6 +59,7 @@ function users(role) {
|
||||
{ meetingId },
|
||||
],
|
||||
intId: { $exists: true },
|
||||
left: false,
|
||||
};
|
||||
|
||||
const User = Users.findOne({ userId, meetingId }, { fields: { role: 1 } });
|
||||
|
Loading…
Reference in New Issue
Block a user