Skip to content

[Docs] Fix/avatar url field mismatch#1013

Merged
saurabhraghuvanshii merged 5 commits intolayer5io:masterfrom
Sbragul26:fix/avatar-url-field-mismatch
May 7, 2026
Merged

[Docs] Fix/avatar url field mismatch#1013
saurabhraghuvanshii merged 5 commits intolayer5io:masterfrom
Sbragul26:fix/avatar-url-field-mismatch

Conversation

@Sbragul26
Copy link
Copy Markdown
Member

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

  • Yes, I signed my commits.

Sbragul26 added 2 commits May 7, 2026 19:24
Signed-off-by: Sbragul26 <sbragul26@gmail.com>
Signed-off-by: Sbragul26 <sbragul26@gmail.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

PR Preview Action v1.6.3
Preview removed because the pull request was closed.
2026-05-07 16:38 UTC

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread layouts/partials/navbar.html Outdated
Comment on lines 330 to 334
if (typeof avatarUrl === "string" && avatarUrl.trim()) {
return avatarUrl.trim();
}

return "";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
if (typeof avatarUrl === "string" && avatarUrl.trim()) {
return avatarUrl.trim();
}
return "";
return (typeof avatarUrl === 'string' && avatarUrl.trim()) || '';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sbragul26 what do you think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both work the same way. Gemini's version is more concise happy to update if preferred..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update it please.

Comment thread layouts/partials/navbar.html Outdated
Comment on lines 330 to 334
if (typeof avatarUrl === "string" && avatarUrl.trim()) {
return avatarUrl.trim();
}

return "";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sbragul26 what do you think?

Sbragul26 added 2 commits May 7, 2026 21:37
Signed-off-by: Sbragul26 <sbragul26@gmail.com>
@saurabhraghuvanshii saurabhraghuvanshii merged commit 6ad4e2c into layer5io:master May 7, 2026
4 checks passed
@saurabhraghuvanshii
Copy link
Copy Markdown
Member

Thanks @Sbragul26, please test on site once deployment complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants