Skip to content

Social: Share posts when no connections are skipped - #55572

Merged
t-wright merged 6 commits into
trunkfrom
claude/jetpack-social-share-queued-5d3a44
Dec 1, 2026
Merged

t-wright merged 6 commits into
trunkfrom
claude/jetpack-social-share-queued-5d3a44

Conversation

@t-wright

@t-wright t-wright commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes MCP-1497

Proposed changes

  • Always send skipped_connections from jetpack-social/share-post, as [] when there's nothing to skip. WordPress.com drops the queued share without it.
  • Accept a single ID or a comma-separated string, which the schema allows, so those accounts stay skipped.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  • Install this branch on a JN site and connect a social network: /wp-admin/admin.php?page=jetpack-social

  • Publish a post to the social network (replace the ID with the ID of the post you want to publish):

    wp eval 'wp_set_current_user( Jetpack_Options::get_option( "master_user" ) ); print_r( wp_get_ability( "jetpack-social/share-post" )->execute( array( "post_id" => 1 ) ) );'
    
  • Check that the post appears on the network and in the editor's Sharing activity. On trunk, it never appears.

  • Get the connection_id:

    wp eval 'wp_set_current_user( Jetpack_Options::get_option( "master_user" ) ); print_r( wp_get_ability( "jetpack-social/get-connections" )->execute() );'
    
  • Run share-post again with that ID as a string (replace 123):

    wp eval 'wp_set_current_user( Jetpack_Options::get_option( "master_user" ) ); print_r( wp_get_ability( "jetpack-social/share-post" )->execute( array( "post_id" => 1, "skipped_connections" => "123" ) ) );'
    
  • Check that it returns jetpack_social_no_connections and shares nothing.

  • Ask your connected agent to publish the post to your connected network and confirm it succeeds.

Always send the skip list from the share-post ability, even when it's empty. WordPress.com drops the queued share without it. Also read a single ID or comma-separated string, so accounts the caller asks to skip stay skipped.
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the claude/jetpack-social-share-queued-5d3a44 branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack claude/jetpack-social-share-queued-5d3a44

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: December 8, 2026
    • Code freeze: December 7, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Social plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control

jp-launch-control Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/publicize/src/abilities/class-social-abilities.php 258/265 (97.36%) -0.01% 0 💚

Full summary · PHP report · JS report

Phan can't tell that the decoded JSON is an array, so it failed static analysis.
@t-wright
t-wright marked this pull request as ready for review November 30, 2026 02:32
@t-wright
t-wright requested review from a team and lezama November 30, 2026 02:41
@saroshaga
saroshaga requested a lite review from Copilot November 30, 2026 04:57

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.

🟡 Changes recommended

Approval is blocked by an unreachable scalar-input normalization caused by the still-array schema, plus missing corresponding changelog entries in the Social and Jetpack plugins.

2 open issues
What changed in this PR

Fixes Jetpack Social post sharing by ensuring queued requests always include a normalized skipped_connections payload.

Changes:

  • Always sends skipped_connections, including when the list is empty.
  • Normalizes array, single-ID, and comma-separated connection inputs.
  • Adds parameterized tests for skip-list handling and skipped-only connections.
  • Documents the fix in the Publicize package changelog.
File Description
projects/​packages/​publicize/​tests/​php/​abilities/​Social_Abilities_Test.php Adds parameterized tests covering empty, array, scalar, comma-separated, duplicate, and skipped-only connection inputs.
projects/​packages/​publicize/​src/​abilities/​class-social-abilities.php Normalizes skipped connection IDs and includes the resulting list in every queued share request.
projects/​packages/​publicize/​changelog/​fix-social-share-post-ability-skipped-connections Documents the Jetpack Social share-post queueing fix.

Review effort: Lite

Jetpack and Social both expose the ability, so their users need to see the fix in each plugin's changelog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Social Issues about the Jetpack Social plugin labels Nov 30, 2026
lezama
lezama previously approved these changes Nov 30, 2026

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

matches the wpcom side, which only sends to every connection when it gets an empty array. wp_parse_id_list() also casts and dedupes, so the strict in_array() below compares ints now. looks good.

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

Tested this on a Jurassic Ninja site with the branch build and a Facebook page connected, going through the WordPress.com MCP connector, and it does what it says.

One thing I wanted to check with you: now that the empty list goes through, a share with no skipped_connections goes to every connection the user can use, including ones the author switched off for that post. The editor turns those toggles into the skip list, but the ability doesn't. If that's intended, could the ability description mention it? Otherwise the default could come from the post's sharing toggles.

Also, I'm wondering if the REST counterpart route also needs the same fix ? (should we file an issue with the team?)

@t-wright

t-wright commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

if that's intended, could the ability description mention it? Otherwise the default could come from the post's sharing toggles.

The toggles you set on a draft are saved and apply when the post is first published, but not to later shares. On a published post, the block editor toggles only affect shares you make from the editor, and they aren't saved. Updated the ability description.

Say in the ability description that the editor toggles have no effect, so agents know where a share goes. Cover rejected and spaced skip lists, and reword the Social changelog entry for people who use the plugin.
…pack-social-share-queued-5d3a44

# Conflicts:
#	projects/packages/publicize/src/abilities/class-social-abilities.php
Publishing shares to the connections switched on for the post, so an agent that then calls share-post can post duplicates. Say so in the ability description.
@t-wright
t-wright merged commit b59ac77 into trunk Dec 1, 2026
96 checks passed
@t-wright
t-wright deleted the claude/jetpack-social-share-queued-5d3a44 branch December 1, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Publicize Now Jetpack Social, auto-sharing [Package] Publicize [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Social Issues about the Jetpack Social plugin [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants