Skip to content

Conversation

@enejb
Copy link
Member

@enejb enejb commented Dec 15, 2025

This PR adds feedback comments support for forms admins.

See

Screen.Recording.2025-12-15.at.3.13.27.PM.mov

Proposed changes:

  • Add notes support for form responses. Make it easy to create and delete notes right in the feedback dashboard.

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

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.

@enejb enejb requested review from a team and Copilot December 15, 2025 23:16
@enejb enejb added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] Needs Review This PR is ready for review. [Package] Forms labels Dec 15, 2025
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 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
Copy link

Copilot AI Dec 15, 2025

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'.

Copilot uses AI. Check for mistakes.
// 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' ) );
Copy link

Copilot AI Dec 15, 2025

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.

Suggested change
createErrorNotice( __( 'Failed to save the note.', 'jetpack-forms' ) );
createErrorNotice( __( 'Failed to delete the note.', 'jetpack-forms' ) );

Copilot uses AI. Check for mistakes.
// Load comments on mount and when postId changes
useEffect( () => {
loadComments();
}, [ postId, createErrorNotice, loadComments, setIsLoadingComments, setError, setComments ] );
Copy link

Copilot AI Dec 15, 2025

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.

Suggested change
}, [ postId, createErrorNotice, loadComments, setIsLoadingComments, setError, setComments ] );
}, [ postId, loadComments ] );

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

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!

@github-actions
Copy link
Contributor

github-actions bot commented Dec 15, 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 add/feedback-commnet-support branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/feedback-commnet-support

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

@jp-launch-control
Copy link

Code Coverage Summary

Cannot generate coverage summary while tests are failing. 🤐

Please fix the tests, or re-run the Code coverage job if it was something being flaky.

Full summary · PHP report · JS report

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

Labels

[Feature] Contact Form [Package] Forms [Status] Needs Review This PR is ready for review. [Tests] Includes Tests [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants