Add: Controls for publishing WordPress comments to Bluesky#199
Merged
Conversation
Give site owners a settings toggle and a configuration constant that stop WordPress comment changes from being published to Bluesky while preserving incoming reactions and existing remote replies. Fixes #197.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a site/admin-controlled kill switch for outbound (WordPress → Bluesky) comment-reply publishing, without impacting inbound reaction sync, and hardens all scheduling/execution paths so previously queued work can’t bypass the effective setting.
Changes:
- Introduces
atmosphere_publish_reactions(default enabled) plusATMOSPHERE_DISABLE_OUTGOING_REACTIONS(forced override) to control outgoing comment replies. - Rechecks the effective setting across direct Publisher calls, cron callbacks, and delete cascades to prevent stale queued work from writing/deleting replies.
- Adds/updates PHPUnit coverage and user/developer documentation for the new controls.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| uninstall.php | Ensures the new option is removed on uninstall. |
| tests/phpunit/tests/wp-admin/class-test-outgoing-reactions-setting.php | Adds wp-admin rendering/constant precedence coverage for the new setting. |
| tests/phpunit/tests/class-test-publisher.php | Adds Publisher-level tests for disabled behavior and delete cascade chunk rechecks. |
| tests/phpunit/tests/class-test-functions.php | Adds unit coverage for outgoing_reactions_enabled() default/option behavior. |
| tests/phpunit/tests/class-test-atmosphere.php | Adds scheduling/cron no-op coverage and deletion-path behavior under the kill switch. |
| readme.txt | Documents the end-user setting and wp-config constant. |
| includes/wp-admin/class-settings-fields.php | Adds the new settings field and forced-disabled UI behavior. |
| includes/functions.php | Introduces outgoing_reactions_enabled() and constant override helper. |
| includes/class-publisher.php | Enforces the kill switch for comment publish/update/delete and for comment delete cascades/chunks. |
| includes/class-options.php | Registers the new boolean option with Settings API + REST visibility. |
| includes/class-atmosphere.php | Ensures scheduling/execution paths respect the effective outgoing-reactions setting. |
| docs/developer-docs.md | Adds developer documentation for the outgoing reaction controls and integration guidance. |
| .github/changelog/add-outgoing-reactions-controls | Adds the user-facing changelog entry for the feature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…g layers /simplify follow-ups: - Check the kill switch first in should_publish_comment(), so a disabled site skips the cache-busting eligibility work and the filter on every comment event. - Drop the redundant comment-TID strip in the delete_records cron handler; delete_post_by_tids() enforces it at execution time. - Replace apply_writes_chunked()'s feature-specific boolean with a generic precondition callable supplied by the one caller that needs per-chunk cancellation, keeping the transport helper policy-free. - Enforce the ATMOSPHERE_DISABLE_OUTGOING_REACTIONS preference preservation at the option-write layer (pre_update_option filter), covering form, REST, and CLI writers alike — the settings form's hidden-input workaround is gone.
…oming replies Pairs them with the new 'Outgoing replies' toggle so the Reactions section reads as a clear incoming/outgoing split.
…avior The incoming settings are labeled 'Incoming reactions' / 'Incoming replies' right below, so the cross-reference sentence is redundant.
'Comments are not sent to Bluesky while this is disabled. Replies that were already published to Bluesky are kept.' — same shape as the incoming toggles' 'skipped while disabled / already imported are kept' copy.
Overload the option read with a pre_option filter while ATMOSPHERE_DISABLE_OUTGOING_REACTIONS is active, pairing it with the existing pre_update preservation guard: every surface — get_option, REST settings, WP-CLI, the settings checkbox — reports the effective value, writes cannot clobber the saved preference, and outgoing_reactions_enabled() becomes a plain option read.
The caller has just checked its own precondition when the first request goes out — the fast-path and first-iteration evaluations could never trip. Also drop two test assertions that pinned the absence of markup no shipped implementation ever emitted.
- Section intro no longer implies every toggle both sends and saves
('sent to Bluesky and which are saved to WordPress').
- The wp-config constant name moves out of the translatable string
into a printf placeholder, matching the long-form field's pattern.
- The between-chunk recheck docblock notes it is an in-process check.
- fn() spacing aligned with the codebase idiom.
…on types Comment replies are the only outgoing reaction type today, hence the 'Outgoing replies' label — but the option, the constant, and outgoing_reactions_enabled() are deliberately named for reactions broadly: future outgoing types honor the same switches instead of growing parallel ones.
…review leftovers Adopt the pattern from #203 for the outgoing-reactions boundary: outgoing_reactions_enabled() resolves the stored option first, then the new atmosphere_should_publish_reactions filter runs last with the final say — the override is on effective behavior, the saved preference stays untouched, and the settings form simply edits the raw option again. The ATMOSPHERE_DISABLE_OUTGOING_REACTIONS constant, the pre_option/ pre_update enforcement filters, and the forced-disabled UI state are gone. Review leftovers in the same pass: - sanitize_callback (rest_sanitize_boolean) on all four boolean settings. - aria-describedby wiring on all four settings checkboxes. - A queued comment-only delete cascade stripped by the kill switch now returns an empty success instead of logging a misleading error.
…elper pattern The reactions-broad naming is gone (decision reversed): the switch is for publishing WordPress comments to Bluesky, so everything now says so — option atmosphere_publish_comments, helper is_comment_publishing_enabled() (the is_*_enabled shape from #203), filter atmosphere_should_publish_comments, error code atmosphere_comment_publishing_disabled. Docs no longer claim the switch pre-covers future reaction types, and the hook table warns about the near-collision with the per-comment atmosphere_should_publish_comment filter.
Third /simplify pass. The $precondition callable on apply_writes_chunked() guarded a mid-cascade toggle flip that nothing in production can trigger anymore — cross-process toggles are invisible to the request's option cache, so only a deliberately time-varying filter could reach it. Drop the parameter, the per-chunk check, and the test pinning it; the entry check before the comment batch remains the boundary. Also: flatten delete_post_by_tids' stripped-flag into one self-contained no-op block, correct the now-false 'kill switch cannot be bypassed by a filter' comment, sweep the retired kill-switch / outgoing-reaction vocabulary from docblocks and tests, and compose the mid-flight reconcile test from force_apply_writes_success() instead of a hand-rolled response fake.
2 tasks
jeherve
added a commit
that referenced
this pull request
Jul 15, 2026
Brings in #199 (controls for publishing WordPress comments to Bluesky) and #198 (require publishing capability for comment replies). Resolve the docs/developer-docs.md hooks-table conflict (keep the connection-only/settings-page rows, take trunk's updated atmosphere_should_publish_comment wording) and extend connection-only mode to the newly merged outgoing lane: is_comment_publishing_enabled() is now forced off in connection-only mode, with its atmosphere_should_publish_comments filter still the final say. Because #199 already re-checks that helper at every layer (direct Publisher calls, the publish-comment cron, on_before_delete cleanup, chunked delete_post_by_tids), the single force-off closes the outgoing-comment gap everywhere. Adds regression tests and updates the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #197
Proposed changes:
atmosphere_should_publish_commentsfilter as the programmatic override: it resolves after the stored setting and has the final say in both directions, without touching the saved preference. This replaces theATMOSPHERE_DISABLE_OUTGOING_REACTIONSconstant originally proposed in Add constant and setting to disable all outgoing reactions #197 — the filter matches the per-feature helper pattern established in Add Connectors API integration and a connection layer other plugins can consume #203 (is_comment_publishing_enabled()).rest_sanitize_booleansanitize callbacks andaria-describedbywiring for all four boolean toggles.Other information:
Testing instructions:
composer lintandnpm run env-test(full suite green).add_filter( 'atmosphere_should_publish_comments', '__return_false' );in a small mu-plugin: outgoing writes stop while the checkbox still shows (and edits) the saved preference; remove the filter and the saved preference applies again.Changelog entry
A validated manual changelog entry is included in
.github/changelog/add-outgoing-reactions-controls.Changelog Entry Details
Significance
Type
Message
Add a setting — and a filter for plugins — to keep WordPress comment changes from being published to Bluesky while leaving incoming reactions enabled.