Explorar o código

make the user.name more robust

Henry Oswald %!s(int64=12) %!d(string=hai) anos
pai
achega
268de7d739

+ 4 - 4
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

+ 4 - 6
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 = {}