mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-06 07:13:58 +00:00
make the user.name more robust
This commit is contained in:
parent
611916119a
commit
268de7d739
2 changed files with 8 additions and 10 deletions
|
@ -22,24 +22,24 @@ define [
|
||||||
|
|
||||||
_buildCookieKey = (testName, bucket)->
|
_buildCookieKey = (testName, bucket)->
|
||||||
key = "sl_abt_#{testName}_#{bucket}"
|
key = "sl_abt_#{testName}_#{bucket}"
|
||||||
console.log key
|
#console.log key
|
||||||
return key
|
return key
|
||||||
|
|
||||||
|
|
||||||
_getTestCookie = (testName, bucket)->
|
_getTestCookie = (testName, bucket)->
|
||||||
cookieKey = _buildCookieKey(testName, bucket)
|
cookieKey = _buildCookieKey(testName, bucket)
|
||||||
cookie = ipCookie(cookieKey)
|
cookie = ipCookie(cookieKey)
|
||||||
console.log cookieKey, cookie
|
#console.log cookieKey, cookie
|
||||||
return cookie
|
return cookie
|
||||||
|
|
||||||
_persistCookieStep = (testName, bucket, newStep)->
|
_persistCookieStep = (testName, bucket, newStep)->
|
||||||
cookieKey = _buildCookieKey(testName, bucket)
|
cookieKey = _buildCookieKey(testName, bucket)
|
||||||
ipCookie(cookieKey, {step:newStep}, {expires:100, path:"/"})
|
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}")
|
ga('send', 'event', 'ab_tests', "#{testName}:#{bucket}", "step-#{newStep}")
|
||||||
|
|
||||||
_checkIfStepIsNext = (cookieStep, 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
|
if !cookieStep? and newStep != 0
|
||||||
return false
|
return false
|
||||||
else if newStep == 0
|
else if newStep == 0
|
||||||
|
|
|
@ -22,13 +22,11 @@ define [
|
||||||
continue
|
continue
|
||||||
# Store data in the same format returned by clientTracking.clientUpdated
|
# Store data in the same format returned by clientTracking.clientUpdated
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@$scope.onlineUsers[user.client_id] = {
|
@$scope.onlineUsers[user.client_id] = {
|
||||||
id: user.client_id
|
id: user.client_id
|
||||||
user_id: user.user_id
|
user_id: user.user_id
|
||||||
email: user.email
|
email: user.email
|
||||||
name: user.first_name
|
name: "#{user.first_name} #{user.last_name}"
|
||||||
doc_id: user.cursorData?.doc_id
|
doc_id: user.cursorData?.doc_id
|
||||||
row: user.cursorData?.row
|
row: user.cursorData?.row
|
||||||
column: user.cursorData?.column
|
column: user.cursorData?.column
|
||||||
|
@ -55,10 +53,10 @@ define [
|
||||||
for client_id, user of @$scope.onlineUsers
|
for client_id, user of @$scope.onlineUsers
|
||||||
if user.doc_id?
|
if user.doc_id?
|
||||||
user.doc = @ide.fileTreeManager.findEntityById(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
|
user.name = user.email
|
||||||
else
|
|
||||||
user.name = "#{user.first_name} #{user.last_name}"
|
|
||||||
@$scope.onlineUsersArray.push user
|
@$scope.onlineUsersArray.push user
|
||||||
|
|
||||||
@$scope.onlineUserCursorHighlights = {}
|
@$scope.onlineUserCursorHighlights = {}
|
||||||
|
|
Loading…
Reference in a new issue