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

Remove the inherit option from the Comments Query Loop and Comment Template #39648

Closed
michalczaplinski opened this issue Mar 22, 2022 · 4 comments · Fixed by #39664
Closed

Remove the inherit option from the Comments Query Loop and Comment Template #39648

michalczaplinski opened this issue Mar 22, 2022 · 4 comments · Fixed by #39664
Assignees
Labels
[Block] Comment Template Affects the Comment Template Block [Block] Comments Affects the Comments Block - formerly known as Comments Query Loop

Comments

@michalczaplinski
Copy link
Contributor

What problem does this address?

#39227 either introduces breaking changes to existing comment pagination functions, OR introduces Gutenberg-dedicated functions that are reliant on how core comments utilize pagination URLs.

But there are underlying challenges brought on when pagination between core comments and comment blocks are out of sync. Both share the same URL, but have to indicate differing indexes of pagination.

What is your proposed solution?

Remove the following options from the Comments Query Loop and Comment Template blocks:

  • perPage
  • order
  • defaultPage
  • inherit

Additionally, we should ALWAYS inherit the related settings from the core Discussion settings.

@michalczaplinski michalczaplinski added [Block] Comments Affects the Comments Block - formerly known as Comments Query Loop [Block] Comment Template Affects the Comment Template Block labels Mar 22, 2022
@michalczaplinski michalczaplinski self-assigned this Mar 22, 2022
@gziolo
Copy link
Member

gziolo commented Mar 23, 2022

I see that the block works now only when the $post object is set on the page.

// Bail out early if the post ID is not set for some reason.
if ( empty( $block->context['postId'] ) ) {
return '';
}

Otherwise, it renders nothing.

Maybe the user-facing name of the block should also change to better align with what is capable of doing. It's a Post Comments List with all the options removed. If you look at the PHP implementation of the WP_Comment_Query class, you can see that it supports a long list of params for the query which makes it very flexible and it definitely can work in all different scenarios:

https://developer.wordpress.org/reference/classes/wp_comment_query/

@luisherranz
Copy link
Member

luisherranz commented Mar 23, 2022

Do you mean dropping the word "Query" from the "Comments Query Loop" name in the block title?

@gziolo
Copy link
Member

gziolo commented Mar 23, 2022

Do you mean dropping the word "Query" from the "Comments Query Loop" name in the block title?

Maybe. I'm mostly confused at the moment what's the current plan for the block. It's much simpler than all the initial explorations and has limited application. Still, it's a great replacement for the existing Post Comments block that shipped in WordPress 5.9. Well, it also makes me realize that at the moment we have two similar blocks 😄

@luisherranz
Copy link
Member

luisherranz commented Mar 29, 2022

It's much simpler than all the initial explorations and has limited application

It is, but I guess it's better to make it public without those options in 6.0 and then evaluate the current issues with the non-inherited options than wait until all the problems are solved, don't you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Comment Template Affects the Comment Template Block [Block] Comments Affects the Comments Block - formerly known as Comments Query Loop
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants