Warn in the editor when the site isn't connected to Bluesky - #246
Closed
jeherve wants to merge 1 commit into
Closed
Conversation
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.
Contributor
There was a problem hiding this comment.
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
isConnectedflag to editor scripts viaBlock_Editor::script_data()(backed byAtmosphere\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.
Member
|
This and other states are already addressed in this PR #233 |
Member
Author
|
Ah, I had missed that PR! Closing this, I'll review the other one. |
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 #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 anisConnectedflag fromAtmosphere\is_connected()(which is also false for a lapsedneeds_reauthconnection). 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:
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:jsmyself.composer lintpasses, 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:
wp option delete atmosphere_connectionwp option update atmosphere_connection '{"access_token":"x","needs_reauth":true}' --format=jsonI ran this on a live Jurassic Ninja site across the connected / disconnected / lapsed-
needs_reauthstates, 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.