mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Handle deleted users in comments gracefully
This commit is contained in:
parent
9a867438b2
commit
64b9fe52dd
2 changed files with 8 additions and 4 deletions
|
@ -30,6 +30,8 @@ module.exports = UserController =
|
|||
res.send JSON.stringify(info)
|
||||
|
||||
formatPersonalInfo: (user, callback = (error, info) ->) ->
|
||||
if !user?
|
||||
return {}
|
||||
formatted_user = { id: user._id.toString() }
|
||||
for key in ["first_name", "last_name", "email", "signUpDate", "role", "institution"]
|
||||
if user[key]?
|
||||
|
|
|
@ -373,7 +373,9 @@ define [
|
|||
return comment
|
||||
|
||||
formatUser = (user) ->
|
||||
if !user?
|
||||
id = user?._id or user?.id
|
||||
|
||||
if !id?
|
||||
return {
|
||||
email: null
|
||||
name: "Anonymous"
|
||||
|
@ -381,13 +383,13 @@ define [
|
|||
hue: ColorManager.ANONYMOUS_HUE
|
||||
avatar_text: "A"
|
||||
}
|
||||
|
||||
id = user._id or user.id
|
||||
if id == window.user_id
|
||||
name = "You"
|
||||
isSelf = true
|
||||
else
|
||||
name = "#{user.first_name} #{user.last_name}"
|
||||
name = [user.first_name, user.last_name].filter((n) -> n?).join(" ")
|
||||
if name == ""
|
||||
name = "Unknown"
|
||||
isSelf = false
|
||||
return {
|
||||
id: id
|
||||
|
|
Loading…
Reference in a new issue