User's name fetched from Orcid not persisting to database
Bug description
- User's first name is always fetched from Orcid regardless of privacy settings.
- It is not being used across the application.
How to reproduce
- Login with a user that doesn't have a username set.
- We can't see the user's name in
- The menu on the left side.
- While reviewing we can only see their Orcid ID
Expected behavior
- Display proper first name or full name rather than username for Menu as well as review.
Technical Stuff
- While user's identity is not being persisted to the database, the code that does it looks like -
user.defaultIdentity.name = `${userDetails.firstName || ''} ${
userDetails.lastName || ''
}`
From the logic it looks like if we don't get the name from Orcid it should be setting it to
${''} ${''}
-> ''
which is an empty string.
It would be better to set it to null.
- We do have the logic to display's user's name
<p>{user.defaultIdentity.name || user.username}</p>
Because of the above described bug, user.defaultIdentity.name
is always null
.
This can be replicated by a console.log(user)
around line 110.
After !335 (merged) this wouldn't be as big of an issue as the username in the kotahi will come from the first and last name from Orcid, but I still think it's a good idea to fix the bug and store data in defaultIdentity
properly.