-
Notifications
You must be signed in to change notification settings - Fork 843
Forms: Add feedback notes support #46309
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
base: trunk
Are you sure you want to change the base?
Conversation
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 adds support for feedback comments/notes on form responses, allowing form admins to add and delete internal notes directly in the feedback dashboard. The implementation leverages WordPress's core comments API to attach notes to feedback posts.
Key changes:
- Enables comments support for the feedback post type with authentication requirements
- Adds a new FeedbackComments React component for displaying, creating, and deleting notes
- Includes comprehensive test coverage for comment permissions and functionality
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/packages/forms/src/contact-form/class-contact-form-plugin.php | Adds comments support to feedback post type and restricts comments to logged-in users |
| projects/packages/forms/src/types/index.ts | Defines FeedbackComment interface based on WordPress REST API response |
| projects/packages/forms/src/dashboard/components/feedback-comments/index.tsx | Implements React component for managing feedback notes |
| projects/packages/forms/src/dashboard/components/feedback-comments/style.scss | Styles for the feedback comments component |
| projects/packages/forms/src/dashboard/components/inspector/body.tsx | Integrates FeedbackComments component into response view |
| projects/packages/forms/tests/php/contact-form/Contact_Form_Plugin_Test.php | Adds comprehensive test coverage for comments functionality |
| projects/packages/forms/changelog/add-feedback-commnet-support | Changelog entry for the feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,4 @@ | |||
| Significance: minor | |||
Copilot
AI
Dec 15, 2025
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.
Corrected spelling of 'commnet' to 'comment' in the filename 'add-feedback-commnet-support'.
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| } catch ( err ) { | ||
| setError( __( 'Failed to delete the note. Please try again.', 'jetpack-forms' ) ); | ||
| createErrorNotice( __( 'Failed to save the note.', 'jetpack-forms' ) ); |
Copilot
AI
Dec 15, 2025
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.
Error message 'Failed to save the note.' is misleading in the delete handler. Should be 'Failed to delete the note.' to accurately describe the delete operation.
| createErrorNotice( __( 'Failed to save the note.', 'jetpack-forms' ) ); | |
| createErrorNotice( __( 'Failed to delete the note.', 'jetpack-forms' ) ); |
| // Load comments on mount and when postId changes | ||
| useEffect( () => { | ||
| loadComments(); | ||
| }, [ postId, createErrorNotice, loadComments, setIsLoadingComments, setError, setComments ] ); |
Copilot
AI
Dec 15, 2025
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.
The useEffect dependency array includes state setters (setIsLoadingComments, setError, setComments) which are stable and don't need to be listed. Additionally, createErrorNotice is already a dependency of loadComments, making it redundant here. The dependency array should only include postId and loadComments.
| }, [ postId, createErrorNotice, loadComments, setIsLoadingComments, setError, setComments ] ); | |
| }, [ postId, loadComments ] ); |
|
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! |
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Code Coverage SummaryCannot generate coverage summary while tests are failing. 🤐 Please fix the tests, or re-run the Code coverage job if it was something being flaky. |
This PR adds feedback comments support for forms admins.
See
Screen.Recording.2025-12-15.at.3.13.27.PM.mov
Proposed changes:
Other information:
Jetpack product discussion
See
Does this pull request change what data or activity we track or use?
No
Testing instructions:
Go the form responses dashboard.
Add a note.
Delete a note.
Does it work like you would expect.