Skip to content

Warn in the editor when the site isn't connected to Bluesky - #246

Closed
jeherve wants to merge 1 commit into
trunkfrom
hide-editor-panel-when-disconnected
Closed

Warn in the editor when the site isn't connected to Bluesky#246
jeherve wants to merge 1 commit into
trunkfrom
hide-editor-panel-when-disconnected

Conversation

@jeherve

@jeherve jeherve commented Aug 27, 2026

Copy link
Copy Markdown
Member

Fixes #245

Proposed changes:

Right now the ATmosphere panel in the block editor looks the same whether or not your site is connected to Bluesky. With sharing on (the default), the "Share this post" toggle says "This post will be shared via ATmosphere when published", even when the connection has lapsed or was never set up. So you publish the post, nothing goes out to Bluesky, and you only find out later, which isn't a fun surprise :)

This adds a warning under the toggle when the site isn't connected: "Your site isn't connected to Bluesky, so this post won't be shared", with a link to reconnect on the settings page. Anyone who can't manage the connection gets the same warning without the link, ending in "Ask an administrator to connect it" instead.

Under the hood, Block_Editor::script_data() now exposes an isConnected flag from Atmosphere\is_connected() (which is also false for a lapsed needs_reauth connection). A new pure helper, shouldShowNotConnectedNotice(), decides when to show the notice: only when sharing is on for the post, and not when a publish error is already telling you to reconnect.

I considered just hiding the panel until you're connected, but the toggle stores a per-post preference that still matters once you reconnect, so hiding it would stop you from setting share intent on drafts while a connection is being sorted out. A notice keeps the panel useful and fills the gap. The pre-publish panel was already connection-aware, so this mostly brings the document sidebar panel in line with it.

Other information:

  • Have you written new tests for your changes, if applicable? Unit tests cover the new shouldShowNotConnectedNotice() helper.

One note on tooling: the JS test/lint runner is blocked in my local environment, so I couldn't run npm run lint:js / test:unit:js myself. composer lint passes, the full PHP suite passes (1121 tests), and I verified the behavior on a live site (below). CI will run the JS lint and unit tests.

Testing instructions:

  1. Connect your site to Bluesky under Settings -> ATmosphere, then start a new post. The ATmosphere panel shows "Share this post" on, with no warning.
  2. Disconnect the site. Quickest way over WP-CLI:
    • Never connected: wp option delete atmosphere_connection
    • Lapsed token: wp option update atmosphere_connection '{"access_token":"x","needs_reauth":true}' --format=json
  3. Reload the editor. Under the toggle you should see an amber warning: "Your site isn't connected to Bluesky, so this post won't be shared. Connect on the settings page."
  4. Reconnect (or restore the option) and reload. The warning is gone.
  5. Log in as an author (not an admin) and repeat step 3. The warning shows without the settings link, ending in "Ask an administrator to connect it".

I ran this on a live Jurassic Ninja site across the connected / disconnected / lapsed-needs_reauth states, and it behaved as expected in each.

Screenshots

Before (disconnected, current release): the panel still shows "Share this post" on with "will be shared when published", so there's no hint the post won't go out.

After (disconnected, this branch): the amber warning shows under the toggle.

(I'll add the before/after screenshots to the PR.)

Changelog entry

Already committed in .github/changelog/add-editor-not-connected-notice (Minor / Added), so no need to check the auto-create box below.

The block-editor share panel showed the "Share this post" toggle as
active even when the site had no live Bluesky connection, so a post set
to share would quietly fail to go out at publish time.

Surface an isConnected flag from Block_Editor::script_data() and show a
warning under the toggle when the site isn't connected, pointing managers
to reconnect on the settings page. This brings the document sidebar panel
in line with the pre-publish panel, which was already connection-aware.

Fixes #245.
Copilot AI lite review requested due to automatic review settings August 27, 2026 19:25
@jeherve jeherve self-assigned this Aug 27, 2026
@jeherve
jeherve requested a review from a team August 27, 2026 19:25

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 editor-side awareness of the site’s Bluesky connection state so authors don’t unknowingly publish posts that are “set to share” but cannot actually be shared due to a missing/lapsed connection.

Changes:

  • Expose a new isConnected flag to editor scripts via Block_Editor::script_data() (backed by Atmosphere\is_connected()).
  • Show an in-editor warning notice under the “Share this post” toggle when sharing is enabled but the site isn’t connected, with capability-aware messaging/linking.
  • Introduce and unit-test a pure helper (shouldShowNotConnectedNotice) to centralize the notice gating logic.

Reviewed changes

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

Show a summary per file
File Description
src/editor-plugin/utils.js Adds shouldShowNotConnectedNotice() helper for deterministic notice gating.
src/editor-plugin/plugin.js Renders the new “not connected” warning notice in the document sidebar panel.
src/editor-plugin/__tests__/plugin.test.js Adds unit tests covering the notice gating helper.
src/config.js Adds IS_CONNECTED export sourced from localized editor options (with safe default).
includes/class-block-editor.php Localizes isConnected to editor scripts via script_data().
build/editor-plugin/plugin.js Updated built artifact reflecting the new editor notice behavior.
build/editor-plugin/plugin.asset.php Updates built asset version hash for editor plugin.
build/pre-publish-panel/plugin.js Updated built artifact (rebuild side effect).
build/pre-publish-panel/plugin.asset.php Updates built asset version hash for pre-publish panel.
build/reactions/index.js Updated built artifact (rebuild side effect).
build/reactions/index.asset.php Updates built asset version hash for reactions block.
build/connectors-card/index.js Updated built artifact (rebuild side effect).
build/connectors-card/index.asset.php Updates built asset version hash for connectors card.
.github/changelog/add-editor-not-connected-notice Adds minor/added changelog entry describing the new editor warning.
Files not reviewed (4)
  • build/connectors-card/index.js: Generated file
  • build/editor-plugin/plugin.js: Generated file
  • build/pre-publish-panel/plugin.js: Generated file
  • build/reactions/index.js: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@pfefferle

pfefferle commented Aug 27, 2026

Copy link
Copy Markdown
Member

This and other states are already addressed in this PR #233

@jeherve

jeherve commented Aug 28, 2026

Copy link
Copy Markdown
Member Author

Ah, I had missed that PR! Closing this, I'll review the other one.

@jeherve jeherve closed this Aug 28, 2026
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.

The editor panel should tell you when your site isn't connected to Bluesky

3 participants