Choose which post types publish to AT Protocol#41
Choose which post types publish to AT Protocol#41kraftbj merged 3 commits intofix/cleanup-gate-splitfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a configurable “supported post types” mechanism so ATmosphere publishing can be enabled per post type via Settings, WordPress-native add_post_type_support( ..., 'atmosphere' ), and the existing atmosphere_syncable_post_types filter.
Changes:
- Introduces
Atmosphere\Post_Typesplus helper functionsAtmosphere\get_supported_post_types()/Atmosphere\is_supported_post_type(). - Adds a new settings option (
atmosphere_support_post_types) and UI field (checkboxes for public post types). - Replaces uses of
Backfill::syncable_post_types()with the new resolver and adds PHPUnit coverage.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/phpunit/tests/class-test-post-types.php | Adds tests for option-driven, native-support, and filter-driven supported post types. |
| includes/wp-admin/class-admin.php | Registers the new option and renders the settings UI; uses supported types for meta box registration. |
| includes/functions.php | Adds bridge helper functions for supported post type queries. |
| includes/class-post-types.php | Implements supported post type resolution + sanitization. |
| includes/class-backfill.php | Switches backfill targeting to the new supported post types list. |
| includes/class-atmosphere.php | Gates frontend link output, preview, and lifecycle hooks using is_supported_post_type(). |
| .github/changelog/add-post-type-support | Changelog entry describing the new capability. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kraftbj
left a comment
There was a problem hiding this comment.
Combined review comments from the full PR pass, including the FOSSE-specific concerns and the remaining existing review concerns.
|
@kraftbj it was not meant to fix what you fixed with your PR already, this was simply meant to extract the functionality to a dedicated class/function instead of a weird artifact that lives in the Backfill structure (which I am not even sure we need). I am happy to point the PR to your branch instead or directly work on your branch. |
Adds an `atmosphere_support_post_types` setting with a checkbox UI in the Publishing section, and exposes WordPress' canonical `add_post_type_support($post_type, 'atmosphere')` opt-in for plugins and themes. Replaces the misnamed `Backfill::syncable_post_types()` with a small `Atmosphere\Post_Types` class plus `get_supported_post_types()` / `is_supported_post_type()` bridge functions. The `atmosphere_syncable_post_types` filter is preserved and now runs after the option/native sources are merged so callers can add or remove from either.
- Empty supported list short-circuits backfill count so an unconfigured site isn't queried with the default `post` fallback. Eligibility is also re-checked per post in the batch handler. - `get_supported()` normalises the filter result: drops empties / non-strings, dedupes after the filter so callbacks can't surface duplicates. - Settings UI now derives checkbox state from the saved option only; post types enabled via `add_post_type_support()` or the filter are noted under the label as "Enabled by another plugin or theme."
- Publish/update cron callbacks re-check is_supported_post_type so a user disabling a post type after queueing prevents the cron firing. Delete callback intentionally unchanged so cleanup still runs. - Post_Types::sanitize uses sanitize_key, drops non-strings/empties, and dedupes so the saved option matches get_supported's canonical format. - Backfill::handle_batch resolves get_supported_post_types once per batch instead of recomputing per ID. - Settings UI now also notes saved post types whose effective state was removed by a filter, so the page doesn't claim a type publishes when runtime would skip it.
1c34027 to
0685c47
Compare
|
I rebased it to your pr. |
|
Verified
All eight threads resolved; ready for formal approval. |
Proposed changes
atmosphere_support_post_types(default['post']).\add_post_type_support( 'book', 'atmosphere' )— picked up automatically.Backfill::syncable_post_types()withAtmosphere\Post_Types+ bridge functionsAtmosphere\get_supported_post_types()andAtmosphere\is_supported_post_type().atmosphere_syncable_post_typesfilter preserved; now runs after the option and native opt-ins are merged so callers can add or remove from either source.Other information
Testing instructions
add_post_type_support( 'book', 'atmosphere' );for a custombookCPT — confirmAtmosphere\get_supported_post_types()includes it even when the option is empty.composer lintandnpm run env-testshould pass.