From 2ec760403f18a78cd13f3a2b8ead1d718ec03ed2 Mon Sep 17 00:00:00 2001 From: Chrystal Griffiths Date: Mon, 11 Feb 2019 11:52:14 +0000 Subject: [PATCH] Revert to method not sending cursorData because of duplication --- .../app/coffee/WebsocketController.coffee | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/services/real-time/app/coffee/WebsocketController.coffee b/services/real-time/app/coffee/WebsocketController.coffee index 734dfc3005..e5c4f0c1c0 100644 --- a/services/real-time/app/coffee/WebsocketController.coffee +++ b/services/real-time/app/coffee/WebsocketController.coffee @@ -129,7 +129,6 @@ module.exports = WebsocketController = # after the initial joinDoc since we know they are already authorised. ## AuthorizationManager.removeAccessToDoc client, doc_id callback() - updateClientPosition: (client, cursorData, callback = (error) ->) -> metrics.inc "editor.update-client-position", 0.1 Utils.getClientAttributes client, [ @@ -145,24 +144,26 @@ module.exports = WebsocketController = cursorData.id = client.id cursorData.user_id = user_id if user_id? cursorData.email = email if email? - cursorData.name = if first_name && last_name - "#{first_name} #{last_name}" - else if first_name - first_name - else if last_name - last_name + if first_name or last_name + cursorData.name = if first_name && last_name + "#{first_name} #{last_name}" + else if first_name + first_name + else if last_name + last_name + ConnectedUsersManager.updateUserPosition(project_id, client.id, { + first_name: first_name, + last_name: last_name, + email: email, + _id: user_id + }, { + row: cursorData.row, + column: cursorData.column, + doc_id: cursorData.doc_id + }, callback) else - "" - ConnectedUsersManager.updateUserPosition(project_id, client.id, { - first_name: first_name, - last_name: last_name, - email: email, - _id: user_id - }, { - row: cursorData.row, - column: cursorData.column, - doc_id: cursorData.doc_id - }, callback) + cursorData.name = "" + callback() WebsocketLoadBalancer.emitToRoom(project_id, "clientTracking.clientUpdated", cursorData) getConnectedUsers: (client, callback = (error, users) ->) -> @@ -221,4 +222,4 @@ module.exports = WebsocketController = for op in update.op if !op.c? return false - return true + return true \ No newline at end of file