-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Comments: Pass $page
as argument to comments functions
#7275
Comments: Pass $page
as argument to comments functions
#7275
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
* @covers ::build_comment_query_vars_from_block | ||
*/ | ||
public function test_build_comment_query_vars_from_block_sets_cpage_var() { | ||
public function test_build_comment_query_vars_from_block_sets_max_num_pages() { |
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.
Not sure if this unit test is valuable anymore.
Thank you, this is looking good! (Well, the argument order of The tricky part is how to land this, and WordPress/gutenberg#63698. It's a bit of a 🐔🥚 problem:
I think we can solve this problem via the following strategy:
This plan should ensure that nothing breaks at any point. @SantosGuillamot Could you take care of item number 1.? 🙌 😊 |
I just answered here, but I am not sure if this will cause an error. From what I understood, the extra argument passed to those functions will just be ignored, but it won't throw an error. If that's the case, I believe we could still manage everything in the same merge:
Having said that, I might be mistaken. I'll start working on adding some unit test coverage until it is clarified. |
I've added a couple of unit tests in this commit based on the existing ones for those functions. Let me know if you think that's not enough. |
$p = self::factory()->post->create(); | ||
$this->go_to( get_permalink( $p ) ); | ||
|
||
$link = get_previous_comments_link( 'Next', 3 ); |
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.
While it doesn't affect the tests, this is a bit misleading, so let's change it to
$link = get_previous_comments_link( 'Next', 3 ); | |
$link = get_previous_comments_link( 'Previous', 3 ); |
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.
You're right. I copied it from the other tests in that file and didn't realize. I can change those as well even if they are not related to this PR.
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.
Done in this commit.
Test coverage looks fine, since most code paths are shared with the case where the
Ah yeah, looks like you're right; I replied there.
Alright, we can do that. I left one more minor note; otherwise this PR is looking good, code-wise. I'll give it some more smoke testing for good measure. |
Ah, one more request -- we should probably add one test for each |
Maybe it even makes sense to include it in the same test? |
I've pushed this commit that I believe should suffice for that use case: f3d0fc3 |
Yep, looks good! Thank you 👍 |
The relevant Gutenberg pull request, that pass the |
Co-authored-by: DAreRodz <darerodz@git.wordpress.org>
bea7428
to
b63b09f
Compare
Now that the packages sync has been committed, I've rebased this branch, and it should be ready. In my testing, the old bug is not there anymore and we are removing the conflicting |
$page
as argument to comments functions$page
as argument to comments functions
@desrosj, is it possible that the props bot doesn't pick up edits to the PR's description when the link to Trac gets added after the comment was created? See this: ![]() Let's see if the |
Still, no luck. No changes in #7275 (comment). There should be listed the author of the ticket that helped in the process. |
I'll just leave this comment here; may that resolve the props-bot issue 🕺 |
@sybrew, that helped. I listed you in props manually, anyway. Major props for all your help to identify and fix the issue😀 Changed committed with https://core.trac.wordpress.org/changeset/59081. |
Follow-up to #6291
As discussed in the original pull request and ticket, it seems
set_query_var
should be removed. However, that change was breaking the comments pagination in some scenarios (see #6291 (review)). In this pull request I'm removingset_query_var
while fixing the mentioned issue.In order to do that, I'm passing a new
$page
argument to the relevant functions and only use thecpage
query var if that is not defined.This pull request has to be tested with WordPress/gutenberg#63698 (comment), which modifies the comment pagination blocks to pass the
$page
argument.Trac ticket: https://core.trac.wordpress.org/ticket/60806
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.