-
Notifications
You must be signed in to change notification settings - Fork 841
Social: Update post publish review prompt #46398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
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. |
There was a problem hiding this 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
useJetpackSocialPreferencesto a genericuseSocialUserPreferenceshook 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.
projects/js-packages/publicize-components/src/components/review-prompt/index.jsx
Show resolved
Hide resolved
projects/js-packages/publicize-components/src/hooks/use-social-user-preferences/index.ts
Show resolved
Hide resolved
projects/js-packages/publicize-components/src/hooks/use-social-user-preferences/index.ts
Show resolved
Hide resolved
Code Coverage SummaryCoverage changed in 5 files.
2 files are newly checked for coverage.
Full summary · PHP report · JS report Coverage check overridden by
I don't care about code coverage for this PR
|
haqadn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...packages/publicize-components/src/components/block-editor/components/post-publish-panels.tsx
Outdated
Show resolved
Hide resolved
projects/js-packages/publicize-components/src/components/review-prompt/index.jsx
Show resolved
Hide resolved
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. |
|
I have added some gap between the buttons for now. |
robertsreberski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works good for me, and I'm glad for adding the fallback styling here for prior versions of WP.
Let's add a little commentary to future us/other maintainers, on why we decided to add this styling.
Other than this, it's very nice PR, and I appreciate seeing tests added as well!
projects/js-packages/publicize-components/src/components/review-prompt/style.module.scss
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
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 19 out of 20 changed files in this pull request and generated 2 comments.
projects/js-packages/publicize-components/src/components/review-prompt/index.jsx
Outdated
Show resolved
Hide resolved
projects/js-packages/publicize-components/src/components/review-prompt/index.jsx
Show resolved
Hide resolved
Added a TODO comment to restore tracking on the 'Leave a Review' link once Notice actions support onClick for links. Reference to related Gutenberg PR included.
There was a problem hiding this comment.
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 19 out of 20 changed files in this pull request and generated 3 comments.
projects/js-packages/publicize-components/src/components/review-prompt/index.jsx
Outdated
Show resolved
Hide resolved
projects/js-packages/publicize-components/src/components/post-publish-review-prompt/index.tsx
Show resolved
Hide resolved
projects/js-packages/publicize-components/src/components/review-prompt/styles.module.scss
Show resolved
Hide resolved
| label: __( 'Leave a Review', 'jetpack-publicize-components' ), | ||
| url: href, | ||
| className: 'is-compact', | ||
| onClick: recordReviewClick, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WordPress/gutenberg#74094 is now merged. So, I have added back the onClick event here alongside url.
grzegorz-cp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good changes 👍

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:
useJetpackSocialPreferencesto a generic user preferences hook, making it easier to add more preferences.Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions: