Skip to content

Social: use connection template in per-network editor#48568

Merged
manzoorwanijk merged 3 commits intotrunkfrom
social-453-use-connection-template-editor
May 7, 2026
Merged

Social: use connection template in per-network editor#48568
manzoorwanijk merged 3 commits intotrunkfrom
social-453-use-connection-template-editor

Conversation

@gmjuhasz
Copy link
Copy Markdown
Contributor

@gmjuhasz gmjuhasz commented May 6, 2026

Fixes SOCIAL-453

Proposed changes

  • Use connection-level templates to prefill per-network message fields in the block editor when no per-post connection override is set.
  • Add per-network fallback help text that clarifies what will be used when the field is empty:
    • Connection template
    • Global template
    • Default network template
  • Gate the new per-network display behavior behind social-message-templates.
  • Plumb optional messageHelp/messagePlaceholder support from SharePostForm to MessageBoxControl.
  • Use the existing messageTemplate setting from social script data/store fallback instead of duplicating the PHP default template in JS.
  • Add tests for per-network prefill/help behavior and for explicit MessageBoxControl help override.
  • Add a Publicize changelog entry.

Related product discussion/links

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

No.

Testing instructions

  • Ensure site features include social-enhanced-publishing and social-message-templates.
  • Open Gutenberg editor for a post and open the Social customize-and-preview UI.
  • Enable per-network customization.
  1. Connection-template prefill
  • Set a connection template for one connection in connection management.
  • Open that connection in per-network customization.
  • Verify the Message field is prefilled with the connection template.
  • Verify help text reads: Connection template will be used if empty.
CleanShot 2026-05-06 at 15 46 57@2x
  1. Global-template fallback helper
  • Use a connection with no connection template.
  • Set a non-empty global message template in Social settings.
  • Verify helper reads: Global template will be used if empty.
CleanShot 2026-05-06 at 15 49 00@2x
  1. Default-network fallback helper
  • Save an empty global message template in Social settings.
  • Use a connection with no connection template.
  • Verify helper reads: The default network template will be used if empty.
CleanShot 2026-05-06 at 15 47 36@2x
  1. Override precedence
  • Enter a non-empty per-network message override.
  • Verify the entered value is shown instead of the connection template.
  1. Feature-flag-off regression
  • Disable social-message-templates.
  • Verify current behavior is preserved (no new fallback helper text and no template-prefill behavior).
  1. Automated checks run
  • pnpm --filter @automattic/jetpack-publicize test -- per-network.test.tsx message-box-control/tests/index.test.js
  • pnpm --filter @automattic/jetpack-publicize typecheck
  • pnpm --filter @automattic/jetpack-publicize run build-production-concurrently

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

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 social-453-use-connection-template-editor branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack social-453-use-connection-template-editor

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
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

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!

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label May 6, 2026
@gmjuhasz gmjuhasz self-assigned this May 6, 2026
@gmjuhasz gmjuhasz added the [Status] Needs Team Review Obsolete. Use Needs Review instead. label May 6, 2026
@gmjuhasz gmjuhasz requested a review from manzoorwanijk May 6, 2026 13:49
@jp-launch-control
Copy link
Copy Markdown

jp-launch-control Bot commented May 6, 2026

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/publicize/_inc/components/customize-and-preview/customization-forms/per-network.tsx 30/42 (71.43%) 71.43% -14 💚

Full summary · PHP report · JS report

export const SOCIAL_NOTES_CONFIG_KEY = 'jetpack_social_notes_config';
export const SHOW_PRICING_PAGE_KEY = 'jetpack-social_show_pricing_page';
export const MESSAGE_TEMPLATE_KEY = 'jetpack_social_message_template';
export const DEFAULT_MESSAGE_TEMPLATE = '{title}\n\n{excerpt}\n\n{url}';
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.

I think we should avoid re-defining this and we should rather use messageTemplate from the script data that I added in #48560, as it reads the saved settings template.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated in 68910cc. I removed the duplicated DEFAULT_MESSAGE_TEMPLATE JS constant and now treat getSocialSettings().messageTemplate as the global template layer. That selector already falls back to the social script-data settings.messageTemplate when REST settings are not loaded, so an empty saved global template now falls through to the network default without hardcoding the PHP default in JS.

Copy link
Copy Markdown
Member

@manzoorwanijk manzoorwanijk left a comment

Choose a reason for hiding this comment

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

Works great

@manzoorwanijk
Copy link
Copy Markdown
Member

Merging this to rebase #48573

@manzoorwanijk manzoorwanijk merged commit db0beb3 into trunk May 7, 2026
78 checks passed
@manzoorwanijk manzoorwanijk deleted the social-453-use-connection-template-editor branch May 7, 2026 07:15
@github-actions github-actions Bot added [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. [Status] Needs Team Review Obsolete. Use Needs Review instead. labels May 7, 2026
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 [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants