Skip to content

Add: Controls for publishing WordPress comments to Bluesky#199

Merged
pfefferle merged 14 commits into
trunkfrom
add/outgoing-reactions-controls
Jul 15, 2026
Merged

Add: Controls for publishing WordPress comments to Bluesky#199
pfefferle merged 14 commits into
trunkfrom
add/outgoing-reactions-controls

Conversation

@pfefferle

@pfefferle pfefferle commented Jul 14, 2026

Copy link
Copy Markdown
Member

Fixes #197

Proposed changes:

  • Add an Outgoing replies setting (Settings → ATmosphere → Reactions) that keeps eligible WordPress comments, edits, and deletions from being published to Bluesky — without disabling incoming reaction sync. The inbound toggles are relabeled Incoming reactions / Incoming replies so the section reads as a clear directional split.
  • Add the atmosphere_should_publish_comments filter 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 the ATMOSPHERE_DISABLE_OUTGOING_REACTIONS constant 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()).
  • Enforce the effective control in direct Publisher calls, queued cron callbacks, and the post-deletion cascades, so stale queued work cannot bypass it. A queued comment-only delete cascade becomes a silent no-op instead of a logged error.
  • Preserve existing remote replies and their local metadata while comment publishing is disabled.
  • Housekeeping on the settings screen: rest_sanitize_boolean sanitize callbacks and aria-describedby wiring for all four boolean toggles.

Other information:

  • Have you written new tests for your changes, if applicable?
  • The settings field uses native WordPress settings markup; no before/after screenshot is included.

Testing instructions:

  • Run composer lint and npm run env-test (full suite green).
  • Go to Settings → ATmosphere → Reactions, uncheck Publish eligible WordPress comments as Bluesky replies, and save.
  • Add, edit, and delete an otherwise eligible local comment; run due cron events and verify no outgoing Bluesky reply write is made while incoming reactions keep syncing.
  • Re-enable the setting and verify eligible comments publish again.
  • Add 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.

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

Add a setting — and a filter for plugins — to keep WordPress comment changes from being published to Bluesky while leaving incoming reactions enabled.

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.
Copilot AI review requested due to automatic review settings July 14, 2026 21:18
@pfefferle pfefferle self-assigned this Jul 14, 2026
@pfefferle
pfefferle requested a review from a team July 14, 2026 21:18
@github-actions github-actions Bot added [Feature] Publisher Publishing to AT Protocol [Feature] WP Admin Admin UI and settings [Tests] Includes Tests PR includes test changes Docs labels Jul 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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) plus ATMOSPHERE_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.

Comment thread includes/class-atmosphere.php
Comment thread includes/wp-admin/class-settings-fields.php
Comment thread includes/wp-admin/class-settings-fields.php Outdated
…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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Comment thread includes/wp-admin/class-settings-fields.php
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Comment thread includes/functions.php
Comment thread includes/wp-admin/class-settings-fields.php
Comment thread readme.txt
Comment thread .github/changelog/add-outgoing-reactions-controls
@pfefferle pfefferle changed the title Add: Controls for outgoing Bluesky reactions Add: Controls for publishing WordPress comments to Bluesky Jul 15, 2026

@jeherve jeherve left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This makes sense to me. 🚢

@pfefferle
pfefferle merged commit 39d2ba7 into trunk Jul 15, 2026
10 checks passed
@pfefferle
pfefferle deleted the add/outgoing-reactions-controls branch July 15, 2026 16:11
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs [Feature] Publisher Publishing to AT Protocol [Feature] WP Admin Admin UI and settings [Tests] Includes Tests PR includes test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add constant and setting to disable all outgoing reactions

3 participants