altered the flow of events. we first receive the get users reply and then we join the meeting. checks have been introduced to see if the user added to the list has the correct fields

This commit is contained in:
Anton Georgiev 2014-06-02 21:40:23 +00:00
parent 05beb77462
commit daea03df05
4 changed files with 24 additions and 24 deletions

View File

@ -68,23 +68,23 @@ trait UsersApp {
//send the reply
outGW.send(new ValidateAuthTokenReply(meetingID, msg.userId, msg.token, true, msg.correlationId))
//join the user
handleUserJoin(new UserJoining(meetingID, msg.userId))
//send the list of users in the meeting
outGW.send(new GetUsersReply(meetingID, msg.userId, users.getUsers))
//send chat history
this ! (new GetChatHistoryRequest(meetingID, msg.userId, replyTo))
//send the list of users in the meeting
outGW.send(new GetUsersReply(meetingID, msg.userId, users.getUsers))
//join the user
handleUserJoin(new UserJoining(meetingID, msg.userId))
//send the presentation
this ! (new GetPresentationInfo(meetingID, msg.userId, replyTo))
//send the whiteboard
//TODO
//this ! (new GetWhiteboardShapesNoIdRequest(meetingID, msg.userId, replyTo))
}
case None => outGW.send(new ValidateAuthTokenReply(meetingID, msg.userId, msg.token, false, msg.correlationId))
}
}
}
def handleRegisterUser(msg: RegisterUser) {

View File

@ -46,8 +46,9 @@ define [
globals.events.on "connection:user_left", (userid) =>
toDel = @get(userid)
@remove(toDel)
globals.events.trigger("users:user_left", userid)
if toDel? # only remove if the user model was found
@remove(toDel)
globals.events.trigger("users:user_left", userid)
globals.events.on "connection:setPresenter", (userid) =>
globals.events.trigger("users:setPresenter", userid)

View File

@ -241,14 +241,9 @@ define [
# Received event for a new user
@socket.on "user_joined_message", (message) =>
requesterId = message.payload?.requester_id
# the requesting user will get the update in the userlist through
# get_users_reply. Therefore this is only for the rest of the users
unless(requesterId is @userId)
userid = message.payload.user.userid
username = message.payload.user.name
globals.events.trigger("connection:user_join", userid, username)
userid = message.payload.user.userid
username = message.payload.user.name
globals.events.trigger("connection:user_join", userid, username)
# Received event when a user leaves
@socket.on "user_left_message", (message) ->

View File

@ -40,12 +40,13 @@ define [
globals.events.on "users:user_list_change", (users) =>
@_removeAllUsers()
for userBlock in users
alert("on user_list_change; adding user:" + JSON.stringify userBlock)
@_addUser(userBlock.id, userBlock.name)
globals.events.on "users:load_users", (users) =>
@_removeAllUsers()
for userBlock in users
@_addUser(userBlock.id, userBlock.name)
@_addUser(userBlock.userid, userBlock.name)
globals.events.on "users:user_join", (userid, username) =>
@_addUser(userid, username)
@ -63,19 +64,22 @@ define [
# Removes all a user from the list #TODO - for now it does not remove but moves to the left hand side
_removeUserByID: (userID)->
@$("#user-"+userID).remove()
#@$("#user-"+userID).parent().context.hidden = "true"
#console.log @$el.children("ul")
# Add a user to the screen.
_addUser: (userID, username) ->
data =
username: username
userID: userID
if userID? and username?
data =
username: username
userID: userID
compiledTemplate = _.template(userTemplate, data)
compiledTemplate = _.template(userTemplate, data)
# TODO!!!! only add the new element if it doesn't exist yet
# this will resolve the problem of users displayed multiple times in the userlist
# TODO!!!! only add the new element if it doesn't exist yet
# this will resolve the problem of users displayed multiple times in the userlist
@$el.children("ul").append compiledTemplate
@$el.children("ul").append compiledTemplate
# Marks a user as selected when clicked.
_userClicked: (e) ->