[Docs] Fix/avatar url field mismatch#1013
[Docs] Fix/avatar url field mismatch#1013saurabhraghuvanshii merged 5 commits intolayer5io:masterfrom
Conversation
Signed-off-by: Sbragul26 <sbragul26@gmail.com>
Signed-off-by: Sbragul26 <sbragul26@gmail.com>
|
There was a problem hiding this comment.
Code Review
This pull request refactors the getAvatarUrl function in navbar.html to use optional chaining and updates the property access from avatar_url to avatarUrl. The review feedback suggests further simplifying the logic into a single return statement to avoid redundant trim() calls and improve code conciseness.
| if (typeof avatarUrl === "string" && avatarUrl.trim()) { | ||
| return avatarUrl.trim(); | ||
| } | ||
|
|
||
| return ""; |
There was a problem hiding this comment.
While this logic is correct, it can be made more concise and efficient. The trim() method is called twice, and the if/else structure can be simplified into a single return statement using logical short-circuiting.
| if (typeof avatarUrl === "string" && avatarUrl.trim()) { | |
| return avatarUrl.trim(); | |
| } | |
| return ""; | |
| return (typeof avatarUrl === 'string' && avatarUrl.trim()) || ''; |
There was a problem hiding this comment.
Both work the same way. Gemini's version is more concise happy to update if preferred..
| if (typeof avatarUrl === "string" && avatarUrl.trim()) { | ||
| return avatarUrl.trim(); | ||
| } | ||
|
|
||
| return ""; |
Signed-off-by: Sbragul26 <sbragul26@gmail.com>
…ragul26/docs into fix/avatar-url-field-mismatch
|
Thanks @Sbragul26, please test on site once deployment complete. |
Notes for Reviewers
Fix: [Docs] Avatar not displaying because API returns avatarUrl (camelCase) but code was reading avatar_url (snake_case). Updated to use avatarUrl to match the API response.
Signed commits