-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Post Author: Avoid errors when the user avatars are disabled #45989
Conversation
Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
if ( authorDetails?.avatar_urls ) { | ||
Object.keys( authorDetails.avatar_urls ).forEach( ( size ) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a regression after #43807.
@@ -172,7 +172,7 @@ function PostAuthorEdit( { | |||
</BlockControls> | |||
|
|||
<div { ...blockProps }> | |||
{ showAvatar && authorDetails && ( | |||
{ showAvatar && authorDetails?.avatar_urls && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed this after fixing the initial regression.
Size Change: +11 B (0%) Total Size: 1.31 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test well and looks good 🚀
Thank you, @Mamaduka! 🙌
What?
Fixes #45980.
PR fixes the JS error when the user avatar display is disabled for the site.
Why?
The user avatars can be disabled on the site level. The blocks should respect that.
How?
Update logic to guard for missing
avatar_urls
property.Testing Instructions
Screenshots or screencast