mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Fix a case where a null user would cause displayName to crash.
This commit is contained in:
parent
77ac6c1baf
commit
5e157bcd16
2 changed files with 7 additions and 4 deletions
|
@ -76,8 +76,8 @@ div#trackChanges(ng-show="ui.view == 'track-changes'")
|
||||||
div.user(ng-repeat="update_user in update.meta.users")
|
div.user(ng-repeat="update_user in update.meta.users")
|
||||||
.color-square(ng-if="update_user != null", ng-style="{'background-color': 'hsl({{ update_user.hue }}, 70%, 50%)'}")
|
.color-square(ng-if="update_user != null", ng-style="{'background-color': 'hsl({{ update_user.hue }}, 70%, 50%)'}")
|
||||||
.color-square(ng-if="update_user == null", ng-style="{'background-color': 'hsl(100, 70%, 50%)'}")
|
.color-square(ng-if="update_user == null", ng-style="{'background-color': 'hsl(100, 70%, 50%)'}")
|
||||||
.name(ng-if="update_user.id != user.id" ng-bind="displayName(update_user)")
|
.name(ng-if="update_user && update_user.id != user.id" ng-bind="displayName(update_user)")
|
||||||
.name(ng-if="update_user.id == user.id") You
|
.name(ng-if="update_user && update_user.id == user.id") You
|
||||||
.name(ng-if="update_user == null") #{translate("anonymous")}
|
.name(ng-if="update_user == null") #{translate("anonymous")}
|
||||||
div.user(ng-if="update.meta.users.length == 0")
|
div.user(ng-if="update.meta.users.length == 0")
|
||||||
.color-square(style="background-color: hsl(100, 100%, 50%)")
|
.color-square(style="background-color: hsl(100, 100%, 50%)")
|
||||||
|
|
|
@ -105,10 +105,13 @@ define [
|
||||||
|
|
||||||
$scope.displayName = (user) ->
|
$scope.displayName = (user) ->
|
||||||
full_name = "#{user.first_name} #{user.last_name}"
|
full_name = "#{user.first_name} #{user.last_name}"
|
||||||
if full_name != " "
|
fallback_name = "Unknown"
|
||||||
|
if !user?
|
||||||
|
fallback_name
|
||||||
|
else if full_name != " "
|
||||||
full_name
|
full_name
|
||||||
else if user.email
|
else if user.email
|
||||||
user.email
|
user.email
|
||||||
else
|
else
|
||||||
"Unknown"
|
fallback_name
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue