Merge pull request #1501 from sharelatex/cmg-anonymous-display-name

Label only truly anonymous users as anonymous

GitOrigin-RevId: c33a5c0584bd8a0603921fcf1579204b5fcac009
This commit is contained in:
Chrystal Maria Griffiths 2019-02-15 13:16:06 +00:00 committed by sharelatex
parent 9abea8ae5f
commit b1c40d2c58

View file

@ -101,8 +101,14 @@ define([
user.doc = this.ide.fileTreeManager.findEntityById(user.doc_id)
}
if ((user.name != null ? user.name.trim().length : undefined) === 0) {
user.name = user.email.trim()
// If the user's name is empty use their email as display name
// Otherwise they're probably an anonymous user
if (user.name === null || user.name.trim().length === 0) {
if (user.email) {
user.name = user.email.trim()
} else if (user.user_id === 'anonymous-user') {
user.name = 'Anonymous'
}
}
user.initial = user.name != null ? user.name[0] : undefined