From 268de7d739a95cc3e1723884d6cc704e0a3d5496 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 9 Dec 2014 11:11:06 +0000 Subject: [PATCH] make the user.name more robust --- .../public/coffee/analytics/AbTestingManager.coffee | 8 ++++---- .../coffee/ide/online-users/OnlineUsersManager.coffee | 10 ++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/services/web/public/coffee/analytics/AbTestingManager.coffee b/services/web/public/coffee/analytics/AbTestingManager.coffee index 2c01a88a6c..53524c8d5d 100644 --- a/services/web/public/coffee/analytics/AbTestingManager.coffee +++ b/services/web/public/coffee/analytics/AbTestingManager.coffee @@ -22,24 +22,24 @@ define [ _buildCookieKey = (testName, bucket)-> key = "sl_abt_#{testName}_#{bucket}" - console.log key + #console.log key return key _getTestCookie = (testName, bucket)-> cookieKey = _buildCookieKey(testName, bucket) cookie = ipCookie(cookieKey) - console.log cookieKey, cookie + #console.log cookieKey, cookie return cookie _persistCookieStep = (testName, bucket, newStep)-> cookieKey = _buildCookieKey(testName, bucket) ipCookie(cookieKey, {step:newStep}, {expires:100, path:"/"}) - console.log("persisting", cookieKey, {step:newStep}) + #console.log("persisting", cookieKey, {step:newStep}) ga('send', 'event', 'ab_tests', "#{testName}:#{bucket}", "step-#{newStep}") _checkIfStepIsNext = (cookieStep, newStep)-> - console.log cookieStep, newStep, "checking if step is next" + #console.log cookieStep, newStep, "checking if step is next" if !cookieStep? and newStep != 0 return false else if newStep == 0 diff --git a/services/web/public/coffee/ide/online-users/OnlineUsersManager.coffee b/services/web/public/coffee/ide/online-users/OnlineUsersManager.coffee index c63bea0ef5..d3cd23937a 100644 --- a/services/web/public/coffee/ide/online-users/OnlineUsersManager.coffee +++ b/services/web/public/coffee/ide/online-users/OnlineUsersManager.coffee @@ -22,13 +22,11 @@ define [ continue # Store data in the same format returned by clientTracking.clientUpdated - - @$scope.onlineUsers[user.client_id] = { id: user.client_id user_id: user.user_id email: user.email - name: user.first_name + name: "#{user.first_name} #{user.last_name}" doc_id: user.cursorData?.doc_id row: user.cursorData?.row column: user.cursorData?.column @@ -55,10 +53,10 @@ define [ for client_id, user of @$scope.onlineUsers if user.doc_id? user.doc = @ide.fileTreeManager.findEntityById(user.doc_id) - if user.first_name?.length == 0 and user.last_name.length == 0 + + if user.name?.trim().length == 0 user.name = user.email - else - user.name = "#{user.first_name} #{user.last_name}" + @$scope.onlineUsersArray.push user @$scope.onlineUserCursorHighlights = {}