Skip to content
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 block: Hide select author controle if there is no postId #40910

Merged

Conversation

mauriac
Copy link
Member

@mauriac mauriac commented May 7, 2022

If there is no postId the select, in post author block, that helps to change post author is hidden.

What?

fixes: #40909

Why?

How?

Testing Instructions

Screenshots or screencast

@mauriac mauriac requested a review from ajitbohra as a code owner May 7, 2022 23:51
Copy link
Member

@amustaque97 amustaque97 left a comment

Choose a reason for hiding this comment

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

@mauriac thank you for working on this. Changes works as expected. I don't see any select dropdown to change author in the block settings when postId doesn't exist.

@amustaque97 amustaque97 merged commit be702fb into WordPress:trunk May 8, 2022
@github-actions github-actions bot added this to the Gutenberg 13.3 milestone May 8, 2022
@mauriac
Copy link
Member Author

mauriac commented May 8, 2022

@mauriac thank you for working on this. Changes works as expected. I don't see any select dropdown to change author in the block settings when postId doesn't exist.

thanks to handle this.

@mauriac mauriac deleted the fix/post-author-throw-console-error branch May 8, 2022 14:09
@ZebulanStanphill ZebulanStanphill added [Block] Post Author Affects the Post Author Block [Package] Block library /packages/block-library labels May 8, 2022
) }
{ !! postId &&
! isDescendentOfQueryLoop &&
!! authors?.length && (
Copy link
Contributor

Choose a reason for hiding this comment

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

Do both !! postId and ! isDescendentOfQueryLoop need to be checked?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have removed the ! isDescendentOfQueryLoop and run some tests and everything seems to be fine. But are we sure that _ isDescendentOfQueryLoop_ will be false each time when _ postId_ will be defined? is there a way to confirm that? Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does postId get passed via context to author blocks in query loops when the query loop is in a post? if it does then we need to keep ! isDescendentOfQueryLoop otherwise no.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Author Affects the Post Author Block [Package] Block library /packages/block-library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Post Author block throw console error when there is no postId
4 participants