Skip to content

Add a Bluesky column and a share action to the posts list - #248

Open
pfefferle wants to merge 9 commits into
trunkfrom
add/posts-list-bluesky-column
Open

Add a Bluesky column and a share action to the posts list#248
pfefferle wants to merge 9 commits into
trunkfrom
add/posts-list-bluesky-column

Conversation

@pfefferle

Copy link
Copy Markdown
Member

Fixes #247

Proposed changes:

Adds a "Bluesky" column to the posts list, and a "Share to Bluesky" row action next to it.

The reason is the two support reports linked from #247: the connection expires, a post gets published while the site is disconnected, and after reconnecting there is no way to push that one post. Sites on managed hosting have no WP-CLI, so the backfill command is not an option for them.

The column shows a link to the record when there is one, the failure reason when the last attempt failed, and an em dash otherwise. A site can carry years of posts from before the plugin was installed, and a column of "not shared" on all of them is noise.

The share action re-queues atmosphere_publish_post, the worker that already runs on publish. It re-checks visibility, decides between a first publish and an update, logs failures and schedules retries, so there is no second publish path here.

Two things I touched while in there:

  • Atmosphere::bsky_web_url_from_uri() was private and only fed the editor panel's REST field. It is public now so the column builds its links the same way, instead of a second builder.
  • The atmosphere_publish_error REST closure body moved into Atmosphere::get_publish_error(), so the editor panel and the column describe a failure identically, including the reconnect-class blanking.

Both surfaces gate on edit_post for the specific post, not on a site-wide capability. The list table shows every author their colleagues' rows, so a column without that check would show a contributor the PDS failure text stored on someone else's post.

The whole surface is gated on is_auto_publish_enabled(), so it is absent rather than inert on a site that shares nothing, and it disappears in connection-only mode. The gate is also re-checked in can_share(), so a filter added later than the registration hook is still honoured.

Other information:

  • Have you written new tests for your changes, if applicable?

28 tests. Worth calling out that the first round of tests passed while the authorization boundary was broken, so the capability tests now use two author-role users and one another's posts, rather than administrator-versus-subscriber, which cannot tell a per-post check from a site-wide one.

Testing instructions:

Connect a Bluesky account and make sure "Automatically share posts" is on.

The column

  • Go to Posts. There is a new "Bluesky" column.
  • Publish a post, wait for cron. The cell becomes a "View post" link. Follow it, it should open the post on bsky.app.
  • Posts from before you installed the plugin show an em dash.
  • Screen Options can hide the column.

Sharing a post that did not make it

  • Disconnect on the ATmosphere settings page.
  • Publish a post. Nothing is shared, and the cell shows the failure.
  • Reconnect.
  • Hover the row, click "Share to Bluesky". You get a notice that it is sharing in the background. Reload after a moment, the cell becomes a link.

The gates

  • Turn off automatic sharing in settings. The column and the action are both gone.
  • As a second author, the other author's rows show an em dash and no share action, even though you can see the rows.
  • Pages: run add_post_type_support( 'page', 'atmosphere' ), and the column and action show up on the Pages screen too, with the action redirecting back to Pages rather than Posts.

Copilot AI lite review requested due to automatic review settings August 28, 2026 07:06
@pfefferle pfefferle self-assigned this Aug 28, 2026
@pfefferle
pfefferle requested a review from a team August 28, 2026 07:06
@github-actions github-actions Bot added [Feature] WP Admin Admin UI and settings [Tests] Includes Tests PR includes test changes labels Aug 28, 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 an admin-side recovery surface for posts that missed cross-posting to Bluesky (e.g., during a disconnect), by surfacing share status directly in list tables and providing a manual “Share to Bluesky” row action that re-queues the existing publish worker.

Changes:

  • Introduces a new WP Admin Post_List component that registers a “Bluesky” column, renders either an appview link / last failure message / em dash, and adds a nonced “Share to Bluesky” row action.
  • Refactors the REST-field publish-error shaping into Atmosphere::get_publish_error() and makes Atmosphere::bsky_web_url_from_uri() public for reuse.
  • Adds PHPUnit coverage for list table rendering, capability gates, and the share handler/redirect behavior.

Reviewed changes

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

File Description
includes/wp-admin/class-post-list.php New WP Admin list-table integration (column rendering, row action, handler, notice).
includes/class-atmosphere.php Wires list-table registration; extracts publish-error shaping helper; exposes appview URL builder.
tests/phpunit/tests/wp-admin/class-test-post-list.php New test suite validating rendering states, per-post authorization, nonces, and scheduling/redirect behavior.
.github/changelog/add-posts-list-bluesky-column Adds a minor “added” changelog entry describing the new UI surface.

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

Comment thread includes/wp-admin/class-post-list.php Outdated
Comment thread includes/wp-admin/class-post-list.php Outdated
Comment thread tests/phpunit/tests/wp-admin/class-test-post-list.php Outdated
Comment thread tests/phpunit/tests/wp-admin/class-test-post-list.php

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 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread includes/functions.php
jeherve
jeherve previously approved these changes Aug 28, 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 is looking good, should be good to merge. I only have one minor, non-blocking comment, and a question below.

At first I was wondering if we should use "ATmosphere" all over that UI though, instead of "Bluesky". What do you think?

Comment thread includes/wp-admin/class-post-list.php Outdated
@pfefferle

Copy link
Copy Markdown
Member Author

I went back and forth on that. I ended up with "Bluesky" on purpose: the column and the row action should name where the post goes, not which plugin sends it. Several plugins add a share action to that list, and "Share via ATmosphere" would leave the reader guessing at the destination. We also use "Bluesky" in all the other user facing text (the settings page, the editor panel, the reconnect notices), so this keeps it consistent. Happy to revisit if you feel strongly though.

@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.

should be good to me for now. 🚢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs [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.

Show the share state in the posts list and allow a manual re-share

3 participants