|
@@ -113,25 +113,28 @@ module.exports = WebsocketController =
|
|
|
], (error, {project_id, first_name, last_name, email, user_id}) ->
|
|
], (error, {project_id, first_name, last_name, email, user_id}) ->
|
|
|
return callback(error) if error?
|
|
return callback(error) if error?
|
|
|
logger.log {user_id, project_id, client_id: client.id, cursorData: cursorData}, "updating client position"
|
|
logger.log {user_id, project_id, client_id: client.id, cursorData: cursorData}, "updating client position"
|
|
|
- cursorData.id = client.id
|
|
|
|
|
- cursorData.user_id = user_id if user_id?
|
|
|
|
|
- cursorData.email = email if email?
|
|
|
|
|
- if first_name? and last_name?
|
|
|
|
|
- cursorData.name = first_name + " " + last_name
|
|
|
|
|
- ConnectedUsersManager.updateUserPosition(project_id, client.id, {
|
|
|
|
|
- first_name: first_name,
|
|
|
|
|
- last_name: last_name,
|
|
|
|
|
- email: email,
|
|
|
|
|
- user_id: user_id
|
|
|
|
|
- }, {
|
|
|
|
|
- row: cursorData.row,
|
|
|
|
|
- column: cursorData.column,
|
|
|
|
|
- doc_id: cursorData.doc_id
|
|
|
|
|
- }, callback)
|
|
|
|
|
- else
|
|
|
|
|
- cursorData.name = "Anonymous"
|
|
|
|
|
- callback()
|
|
|
|
|
- WebsocketLoadBalancer.emitToRoom(project_id, "clientTracking.clientUpdated", cursorData)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ AuthorizationManager.assertClientCanViewProject client, (error) ->
|
|
|
|
|
+ return callback(error) if error?
|
|
|
|
|
+ cursorData.id = client.id
|
|
|
|
|
+ cursorData.user_id = user_id if user_id?
|
|
|
|
|
+ cursorData.email = email if email?
|
|
|
|
|
+ if first_name? and last_name?
|
|
|
|
|
+ cursorData.name = first_name + " " + last_name
|
|
|
|
|
+ ConnectedUsersManager.updateUserPosition(project_id, client.id, {
|
|
|
|
|
+ first_name: first_name,
|
|
|
|
|
+ last_name: last_name,
|
|
|
|
|
+ email: email,
|
|
|
|
|
+ user_id: user_id
|
|
|
|
|
+ }, {
|
|
|
|
|
+ row: cursorData.row,
|
|
|
|
|
+ column: cursorData.column,
|
|
|
|
|
+ doc_id: cursorData.doc_id
|
|
|
|
|
+ }, callback)
|
|
|
|
|
+ else
|
|
|
|
|
+ cursorData.name = "Anonymous"
|
|
|
|
|
+ callback()
|
|
|
|
|
+ WebsocketLoadBalancer.emitToRoom(project_id, "clientTracking.clientUpdated", cursorData)
|
|
|
|
|
|
|
|
getConnectedUsers: (client, callback = (error, users) ->) ->
|
|
getConnectedUsers: (client, callback = (error, users) ->) ->
|
|
|
metrics.inc "editor.get-connected-users"
|
|
metrics.inc "editor.get-connected-users"
|