Skip to content

Wire JetpackSocial into Custom Post Settings#25546

Open
crazytonyli wants to merge 7 commits intotrunkfrom
task/jetpack-social-custom-post-sharing
Open

Wire JetpackSocial into Custom Post Settings#25546
crazytonyli wants to merge 7 commits intotrunkfrom
task/jetpack-social-custom-post-sharing

Conversation

@crazytonyli
Copy link
Copy Markdown
Contributor

Adds a new "Share to social media" section to Post Settings for custom post types when the socialSharingV2 feature flag is enabled. The section shows the site's connected social accounts with per-connection toggles, an optional custom message field, and an "Add a connection" entry point that reuses the OAuth flow from the Social screen.

On save, the post payload now includes jetpack_publicize_connections in additional fields and jetpack_publicize_message in post meta, so Jetpack Social can publish the post to the selected accounts.

Simulator.Screen.Recording.-.iPhone.Air.-.2026-05-08.at.21.47.56.mov

Adds a new "Share to social media" section to Post Settings for custom
post types when the socialSharingV2 feature flag is enabled. The
section shows the site's connected social accounts with per-connection
toggles, an optional custom message field, and an "Add a connection"
entry point that reuses the OAuth flow from the Social screen.

On save, the post payload now includes jetpack_publicize_connections
in additional fields and jetpack_publicize_message in post meta, so
Jetpack Social can publish the post to the selected accounts.
@crazytonyli crazytonyli added this to the 26.9 milestone May 8, 2026
@crazytonyli crazytonyli requested review from jkmassel and mokagio May 8, 2026 09:50
@dangermattic
Copy link
Copy Markdown
Collaborator

1 Warning
⚠️ This PR is larger than 500 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented May 8, 2026

App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number32189
VersionPR #25546
Bundle IDorg.wordpress.alpha
Commit61dad94
Installation URL3qc874r9ehrn0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented May 8, 2026

App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number32189
VersionPR #25546
Bundle IDcom.jetpack.alpha
Commit61dad94
Installation URL0kuucerrg133g
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Wires Jetpack Social “Share to social media” (v2) into Custom Post Type Post Settings behind the socialSharingV2 feature flag, including UI for per-connection toggles + custom message, and encoding the resulting state into REST update/create payloads.

Changes:

  • Adds a v2 social sharing entry + detail flow in Post Settings, backed by a PostSocialSharingDraft binding and SiteSocialConnectionsService.
  • Encodes jetpack_publicize_connections into additional_fields and jetpack_publicize_message into post meta for update/create requests.
  • Extends JetpackSocial with draft/model helpers, a new detail view, and updated add-connection flow to return the created SocialConnection, plus new/updated tests.

Reviewed changes

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

Show a summary per file
File Description
WordPress/Classes/ViewRelated/Post/PostSettings/PostSettingsViewModelProtocol.swift Adds optional v2 social sharing binding surface for host view models.
WordPress/Classes/ViewRelated/Post/PostSettings/PostSettingsView.swift Dispatches between legacy vs v2 social sharing UI; adds Jetpack-branded section entry.
WordPress/Classes/ViewRelated/Post/PostSettings/PostSettings.swift Persists draft state in PostSettings and encodes publicize connections/message into REST params.
WordPress/Classes/ViewRelated/Post/PostSettings/CustomPostSettingsViewModel.swift Plumbs JetpackSocial service + add-connection coordinator; exposes v2 binding; initializes draft from fetched post.
Tests/KeystoneTests/Tests/Features/Posts/PostSettingsTests.swift Adds coverage for publicize message clearing/preservation and connections encoding in update params.
Tests/KeystoneTests/Tests/Features/Posts/CustomPostSettingsViewModelTests.swift New regression tests around hasChanges behavior with social v2 draft state.
Tests/KeystoneTests/Tests/Features/Posts/CustomPostEditorServiceTests.swift Adds coverage ensuring create/update local application carries social draft into params/pending settings.
Modules/Tests/JetpackSocialTests/SiteSocialConnectionsServiceTests.swift Removes test relying on deleted currentConnectionIDs() API.
Modules/Tests/JetpackSocialTests/PostSocialSharingDraftTests.swift New tests for draft parsing/round-trips and publicize field/meta helpers.
Modules/Sources/JetpackSocial/Views/PostSocialSharingDetailView.swift New SwiftUI detail screen (toggles + custom message) and summary helper.
Modules/Sources/JetpackSocial/Views/AddConnectionCoordinator.swift Adds optional callback for newly created connection and wires it through success path.
Modules/Sources/JetpackSocial/Views/AccountConfirmationView.swift Adjusts completion to return the created SocialConnection instead of the keyring account.
Modules/Sources/JetpackSocial/Strings/Strings.swift Adds localized strings for the Post Settings social-sharing section.
Modules/Sources/JetpackSocial/Services/SiteSocialConnectionsService.swift Removes currentConnectionIDs() API.
Modules/Sources/JetpackSocial/Services/PostSocialSharingDraft.swift Introduces PostSocialSharingDraft model for message + per-connection enablement state.
Modules/Sources/JetpackSocial/Models/WpAdditionalFields+Publicize.swift Adds parsing/encoding helpers for jetpack_publicize_connections.
Modules/Sources/JetpackSocial/Models/PostMeta+Publicize.swift Adds parsing/encoding helpers for jetpack_publicize_message.
AGENTS.md Adds guidance about Core Data concurrency and avoiding cross-thread managed object capture.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants