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

Ensure the current post does not appear in auto generated lists of backfilled posts #162

Merged
merged 15 commits into from
Apr 22, 2024

Conversation

attackant
Copy link
Member

@attackant attackant commented Apr 4, 2024

Addresses #93

Ensure the current post is not included in the any auto generated lists of backfilled posts (but the user can still choose it.) Also includes npm audit fix and a minor refactor for readability (hopefully)

This update changes the handling of the backfillPosts response in the wp-curate plugin. It introduces a check to filter out the currentPostId from the response array or return null if the response is an individual post matching the current post. This ensures that the current post is not included in the backfillPosts attribute.
The version in wp-curate.php has been updated to 1.8.3. In this update, logic is also added to the backfillPosts query in the wp-curate plugin. This change is to ensure that the current post is not included in the array of backfilled posts, providing a more accurate and desired output.
@attackant attackant changed the title Issue 93 Ensure the current post does not appear in auto generated lists of backfilled posts Apr 4, 2024
@mogmarsh
Copy link
Collaborator

mogmarsh commented Apr 4, 2024

I don't think this addresses the front end

@mogmarsh
Copy link
Collaborator

mogmarsh commented Apr 4, 2024

I think to handle the front end, we should add a query class that will exclude the current post, then add that query class in https://github.com/alleyinteractive/wp-curate/blob/develop/src/features/class-query-block-context.php
I can try to help, or @dlh01 really knows this setup.

@dlh01
Copy link
Member

dlh01 commented Apr 4, 2024

The Exclude_Queries class in Type Extensions could be used, if you can supply the current post ID to it: https://github.com/alleyinteractive/wp-type-extensions/blob/a67070fc2d03422c5e24f83a211bffea7845ffa3/src/alley/wp/post-queries/class-exclude-queries.php

@attackant
Copy link
Member Author

The Exclude_Queries class in Type Extensions could be used, if you can supply the current post ID to it: https://github.com/alleyinteractive/wp-type-extensions/blob/a67070fc2d03422c5e24f83a211bffea7845ffa3/src/alley/wp/post-queries/class-exclude-queries.php

Thanks! I will check it out, I was just trying to roll my own

This commit includes an update to various npm package versions including 'body-parser', 'express', 'ip', 'follow-redirects', 'cookie', 'raw-body' and 'webpack-dev-middleware'. These updates are aimed at improving the overall functionality and security of the dependencies. Each library has been updated to a newer version, ensuring that we're using the latest available code.
This commit overhauls the filter_query_context method in the WP-Curate WordPress plugin. It reorganizes code for improved readability and clarity
Copy link
Collaborator

@mogmarsh mogmarsh left a comment

Choose a reason for hiding this comment

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

I think this looks good. As far as I can tell the logic should be the same on the front end. Did you get the same results in the editor and the front end with this change? And did you get the same results on the front end with the current production and this PR (with the exception of removing the current post)?
I'm going to create an issue to add some tests so we can make changes like this with more confidence.

blocks/query/edit.tsx Outdated Show resolved Hide resolved
Copy link
Member

@dlh01 dlh01 left a comment

Choose a reason for hiding this comment

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

Updates on the queries side look good to me!

src/features/class-query-block-context.php Outdated Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
The class Query_Block_Context is no longer readonly to support PHP 8.1. Its properties have also been updated to readonly to prevent unintentional changes. An inline comment has been added for code clarification.
The version of the WP Curate plugin has been updated in the changelog, from 1.8.3 to 1.9.0. The change reflects the latest enhancements including the exclusion of the current post in backfilled post queries.
This commit updates the WP Curate plugin to version 1.9.0 and makes minor changes to the code for better readability. It also shifts the add_action function and InstalledVersions class to the global namespace to eliminate the need for backslashes.
This commit introduces a fallback case in the object destructuring assignment in query block edit.tsx to improve error handling. Additionally, it refines the parameter type in the useSelect hook for better type safety, making the logic clearer and securing the implementation.
The commit includes a minor type assertion alteration and makes a slight adjustment in a function argument within 'edit.tsx'. The "(window as any as Window)" is modified to ensure that it correctly uses TypeScript type assertion. Also, "(select: any)" is updated in the 'useSelect' function, removing the unnecessary type info from the argument.
@attackant attackant merged commit 74cdca5 into develop Apr 22, 2024
7 checks passed
@attackant attackant deleted the issue-93 branch April 22, 2024 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants