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

Only run filter once. #5260

Closed
wants to merge 8 commits into from
Closed

Conversation

spacedmonkey
Copy link
Member

Trac ticket: https://core.trac.wordpress.org/ticket/58329

This PR replaces #4874. Basically, only run the filter method once in get_term. Run if the object has been filtered or the filter parameter does match the one passed in the function.

This fix would also fix the issues found in https://core.trac.wordpress.org/ticket/58327


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.

Copy link
Member

@mukeshpanchal27 mukeshpanchal27 left a comment

Choose a reason for hiding this comment

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

Thanks @spacedmonkey for the PR. Left some unit test related feedbacks.

tests/phpunit/tests/term.php Outdated Show resolved Hide resolved
tests/phpunit/tests/term.php Outdated Show resolved Hide resolved
tests/phpunit/tests/term.php Outdated Show resolved Hide resolved
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
@spacedmonkey
Copy link
Member Author

Thanks @spacedmonkey for the PR. Left some unit test related feedbacks.

Actioned feedback.

Co-authored-by: Colin Stewart <79332690+costdev@users.noreply.github.com>
Copy link
Member

@joemcgill joemcgill left a comment

Choose a reason for hiding this comment

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

I like this approach much better. The tests that you've added already pass without this change in trunk, so it would be nice to add a test that demonstrates the exact problem you're trying to fix. I've been trying to work something up, but haven't had success yet. Will keep messing with it, but you may beat me to it.

tests/phpunit/tests/term.php Show resolved Hide resolved
spacedmonkey and others added 2 commits September 21, 2023 12:23
Co-authored-by: Joe McGill <801097+joemcgill@users.noreply.github.com>
@spacedmonkey
Copy link
Member Author

I like this approach much better. The tests that you've added already pass without this change in trunk, so it would be nice to add a test that demonstrates the exact problem you're trying to fix. I've been trying to work something up, but haven't had success yet. Will keep messing with it, but you may beat me to it.

@joemcgill The fact that the test works in trunk was the point. To see no breakage. I have added one more unit test, that proved that sanativation is only run once. Can you take another look at this PR.

Copy link
Member

@joemcgill joemcgill left a comment

Choose a reason for hiding this comment

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

Thanks @spacedmonkey! I understood why you had written the original tests. I just wanted to make sure that we also had a test that confirmed the filter is only being run once (so a future change doesn't cause a regression). The new test you've added seems to do the trick!

Copy link
Contributor

@costdev costdev left a comment

Choose a reason for hiding this comment

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

Thanks for the updates @spacedmonkey! Just a few final notes 🙂

tests/phpunit/tests/term.php Outdated Show resolved Hide resolved
tests/phpunit/tests/term.php Outdated Show resolved Hide resolved
Co-authored-by: Colin Stewart <79332690+costdev@users.noreply.github.com>
@spacedmonkey
Copy link
Member Author

Thanks for the updates @spacedmonkey! Just a few final notes 🙂

Thanks @costdev Feedback actioned. Once I get an approval from you, I will commit.

Copy link
Contributor

@costdev costdev left a comment

Choose a reason for hiding this comment

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

Thanks @spacedmonkey! LGTM 👍

@spacedmonkey
Copy link
Member Author

Committed c1247f6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants