Skip to content

Conversation

@manzoorwanijk
Copy link
Member

@manzoorwanijk manzoorwanijk commented Dec 23, 2025

Closes SOCIAL-249

Our review prompt in the sidebar looks a bit off and doesn't follow the core component styles. I updated the component to use the Core Notice component and took the opportunity to clean up other related things.

Proposed changes:

  • Update review prompt to use Core notice component instead of our own custom one.
  • Convert useJetpackSocialPreferences to a generic user preferences hook, making it easier to add more preferences.
  • Remove some unused code from Social plugins and Publicize package for dismissing notices.
  • Updated the review prompt logic to use the core preferences store to save review prompt dismissed preference instead of a custom REST endpoint.
  • Updated the logic to allow reviews for both Social and Jetpack plugins.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

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

Testing instructions:

  • Publish a post and make sure that it's set to be shared to at least one social media account.
  • On the post-publish screen, confirm that you see the review prompt.
  • Confirm that the panel has the title "Jetpack Social"
  • Open the "Leave review" link in a new tab.
  • Confirm that it opens the Jetpack reviews or Social reviews page depending up whether the Social plugin is active.
  • Click on "Dismiss"
  • Confirm that the review prompt is hidden immediately.
  • Now publish another post
  • Confirm that the review prompt is not shown anymore.
  • If you need to do more testing by resetting the preference, you can run this in the browser console.
wp.data.dispatch('core/preferences').toggle('jetpack/social', 'review_prompt_dismissed')
Before After
Screenshot 2025-12-23 at 2 36 21 PM Screenshot 2025-12-23 at 2 45 58 PM

@github-actions
Copy link
Contributor

github-actions bot commented Dec 23, 2025

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 update/social/review-prompt branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/social/review-prompt

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
Contributor

github-actions bot commented Dec 23, 2025

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 a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ 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!


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.

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

This PR refactors the review prompt functionality in the Jetpack Social plugin to use WordPress core components and the core preferences store instead of custom implementations. The changes remove backend REST endpoints and PHP logic for managing the review prompt, replacing them with client-side preference management.

Key Changes

  • Migrated review prompt from custom REST endpoint to WordPress core preferences store
  • Converted useJetpackSocialPreferences to a generic useSocialUserPreferences hook supporting multiple preference types
  • Updated review prompt UI to use core Notice component instead of custom styled component
  • Removed unused PHP code for dismissed notices and review prompt state management

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
projects/plugins/social/src/class-rest-settings-controller.php Removed REST endpoint /jetpack/v4/social/review-dismiss that was handling review dismissal
projects/plugins/social/src/class-jetpack-social.php Removed constants, methods, and hooks related to review prompt initial state and dismissal tracking
projects/packages/publicize/src/class-publicize-setup.php Removed registration of dismissed notices options
projects/packages/publicize/src/jetpack-social-settings/class-dismissed-notices.php Deleted entire dismissed notices class and functionality
projects/packages/publicize/tests/php/jetpack-social-settings/Dismissed_Notices_Test.php Removed corresponding test file for deleted dismissed notices class
projects/js-packages/publicize-components/src/types.ts Removed review property from SocialScriptData interface
projects/js-packages/publicize-components/src/hooks/use-social-user-preferences/index.ts New generic hook for managing user preferences with support for both pre-publish confirmation and review prompt dismissal
projects/js-packages/publicize-components/src/hooks/use-jetpack-social-preferences/index.ts Deleted old single-purpose preferences hook
projects/js-packages/publicize-components/src/components/review-prompt/index.jsx Refactored to use core Notice component, removed custom styling and one tracking event
projects/js-packages/publicize-components/src/components/review-prompt/styles.module.scss Removed as styling now handled by core Notice component
projects/js-packages/publicize-components/src/components/post-publish-review-prompt/index.tsx Updated to use new preferences hook and determine review URL based on active plugin
projects/js-packages/publicize-components/src/components/pre-publish-preview/index.tsx Updated to use new generic preferences hook
projects/js-packages/publicize-components/src/components/unified-modal/social-post-preview/confirmation-config.tsx Updated to use new generic preferences hook
projects/js-packages/publicize-components/src/social-store/actions/social-settings.ts New action file for social settings (replacing pricing-page actions)
projects/js-packages/publicize-components/src/social-store/actions/index.ts Updated imports to use new social-settings instead of pricing-page

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

Comment on lines +30 to +35
{
variant: 'primary',
label: __( 'Leave a Review', 'jetpack-publicize-components' ),
url: href,
className: 'is-compact',
},
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

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

The tracking event for clicking the "Leave a Review" link has been removed. While the dismiss click tracking remains, the click tracking for the primary action (leaving a review) is missing. This makes it harder to measure the effectiveness of this prompt and understand user engagement with the review request.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@haqadn haqadn Dec 23, 2025

Choose a reason for hiding this comment

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

The tracking event for clicking the "Leave a Review" link has been removed. While the dismiss click tracking remains, the click tracking for the primary action (leaving a review) is missing. This makes it harder to measure the effectiveness of this prompt and understand user engagement with the review request.

I assume this is because we will see the stats on jp redirect for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Also, the Notice component actions have the limitations right now that we can't use onClick with url

More details in WordPress/gutenberg#74090

@jp-launch-control
Copy link

jp-launch-control bot commented Dec 23, 2025

Code Coverage Summary

Coverage changed in 6 files. Only the first 5 are listed here.

File Coverage Δ% Δ Uncovered
projects/js-packages/publicize-components/src/components/unified-modal/social-post-preview/confirmation-config.tsx 0/4 (0.00%) 0.00% 2 ❤️‍🩹
projects/js-packages/publicize-components/src/components/post-publish-review-prompt/index.tsx 0/13 (0.00%) 0.00% -2 💚
projects/js-packages/publicize-components/src/components/review-prompt/index.jsx 0/6 (0.00%) 0.00% -2 💚
projects/packages/publicize/src/class-publicize-setup.php 13/75 (17.33%) 0.67% -3 💚
projects/plugins/social/src/class-jetpack-social.php 46/86 (53.49%) 5.53% -11 💚

2 files are newly checked for coverage.

File Coverage
projects/js-packages/publicize-components/src/social-store/actions/social-settings.ts 0/3 (0.00%) 💔
projects/js-packages/publicize-components/src/hooks/use-social-user-preferences/index.ts 14/14 (100.00%) 💚

Full summary · PHP report · JS report

Coverage check overridden by I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. .

@manzoorwanijk manzoorwanijk added the I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. label Dec 23, 2025
Copy link
Contributor

@haqadn haqadn left a comment

Choose a reason for hiding this comment

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

I'm not seeing the margin between the buttons.

Google Chrome 2025-12-23 13 44 37

const PostPublishPanels = () => {
return (
<ThemeProvider targetDom={ document.body }>
{ isJetpackSelfHostedSite() && <PostPublishReviewPrompt /> }
Copy link
Contributor

Choose a reason for hiding this comment

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

Didn't notice it at first, and was wondering why the review prompt isn't appearing on my JN site. I am curious about why we want to hide it for hosted sites. Don't we want to show it in Pressable, Bluehost or even WPCOM sites? I understand we might want to hide it because JP comes prepackaged. I just want to understand the rationale clearly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Before this PR, the review prompt was shown only if the Social standalone plugin was active. In this PR, I changed the logic to allow it for the Jetpack plugin as well, and why not? So, I thought to add a guardrail to ensure it's shown on the self-hosted sites only. Maybe a better solution/fix is to skip it only on WPCOM? What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have a strong opinion on this. Not showing where it's prepackaged makes sense. But, also it is a distinct product and the notice is not too intrusive. I'm happy either way.

Comment on lines +30 to +35
{
variant: 'primary',
label: __( 'Leave a Review', 'jetpack-publicize-components' ),
url: href,
className: 'is-compact',
},
Copy link
Contributor

@haqadn haqadn Dec 23, 2025

Choose a reason for hiding this comment

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

The tracking event for clicking the "Leave a Review" link has been removed. While the dismiss click tracking remains, the click tracking for the primary action (leaving a review) is missing. This makes it harder to measure the effectiveness of this prompt and understand user engagement with the review request.

I assume this is because we will see the stats on jp redirect for this?

haqadn

This comment was marked as duplicate.

@manzoorwanijk
Copy link
Member Author

I'm not seeing the margin between the buttons.

That is because of the issues in Core Notice component which we are now using throughout the codebase. That issue has already been fixed and is already available via the Gutenberg plugin if you install it. That change should be available in the next WP release. Thus, we are not using any custom styles here as it will be automatically be fixed.

@haqadn
Copy link
Contributor

haqadn commented Dec 24, 2025

I'm not seeing the margin between the buttons.

That is because of the issues in Core Notice component which we are now using throughout the codebase. That issue has already been fixed and is already available via the Gutenberg plugin if you install it. That change should be available in the next WP release. Thus, we are not using any custom styles here as it will be automatically be fixed.

I think we should put a little bit of custom style that matches the final outcome. This way it won't look broken until the new version of WP is out or if someone decides to delay their WP update.

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 I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage. [JS Package] Publicize Components [Package] Publicize [Plugin] Social Issues about the Jetpack Social plugin RNA [Status] Needs Team Review Obsolete. Use Needs Review instead. [Tests] Includes Tests [Type] Task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants