-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Remove ignored in:body GraphQL search query
#10439
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
Conversation
The `in:body` qualifier does not exist in GraphQL, only in GitHub's search syntax. This adds a `.filter()` before mapping the pull request numbers to the variable that is returned. The filter checks for the presence of the needles within the pull request's body text, which helps filter out any instances where a Trac ticket is referenced within a comment or PR review.
This ensures the search is case-insensitive.
This is not used. Since `is:open` is passed in the search query, there's no need to retrieve the state.
|
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. |
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.
LGTM
This is what I was thinking when I mentioned this https://wordpress.slack.com/archives/C02RQBWTW/p1760401529768629
in:body GraphQL search qualifierin:body GraphQL search query
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 looks sensible to me.
This comment was marked as outdated.
This comment was marked as outdated.
| // Since search queries will match anywhere for any activity on a pull request, the body specifically needs to be manually checked. | ||
| const matchingPRs = result.search.nodes | ||
| .filter( | ||
| const bodyLower = pr.bodyText.toLowerCase(); |
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 looks like a syntax error to me. Shouldn't the arg to the filter() method look something like:
( pr ) => {
const bodyLower = pr.bodyText.toLowerCase();
return bodyLower.includes(tracTicketUrl) || bodyLower.includes(corePrefix);
}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.
| .filter( | ||
| const bodyLower = pr.bodyText.toLowerCase(); | ||
| pr => pr.bodyText.includes(tracTicketUrl) || pr.bodyText.includes(corePrefix) | ||
| ) |
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.
| .filter( | |
| const bodyLower = pr.bodyText.toLowerCase(); | |
| pr => pr.bodyText.includes(tracTicketUrl) || pr.bodyText.includes(corePrefix) | |
| ) | |
| .filter(( pr ) => { | |
| const bodyLower = pr.bodyText.toLowerCase(); | |
| return bodyLower.includes(tracTicketUrl) || bodyLower.includes(corePrefix); | |
| }) |
The
in:bodyqualifier is not respected in GraphQL search queries for some reason.This adds a
.filter()before mapping the pull request numbers to the variable that is returned. The filter checks for the presence of the (case insensitive) needles within the pull request's body text, which helps filter out any instances where a Trac ticket is referenced within a comment or PR review.This also removes the
statefield. Sinceis:openis in the search query, all returned pull requests will be open making the state is unnecessary.Trac ticket: https://core.trac.wordpress.org/ticket/64175
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.