-
Notifications
You must be signed in to change notification settings - Fork 834
Forms: Add unread/read filtering #45514
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
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! |
… the filters always return the expected results.
…t the count is more accurate
8afbb6b
to
e5e1f70
Compare
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
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
Adds a read/unread filter to the Forms dashboard and wires it through UI, store, and REST endpoints so counts and lists can be filtered consistently.
- Introduces is_unread filter for feedback list and counts endpoints.
- Adds query-keyed counts caching in the dashboard store, with selectors updated to return per-query counts.
- Updates UI to expose a “Read status” filter and adjusts empty-state messaging accordingly.
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
projects/packages/forms/tests/php/contact-form/class-utility.php | Test utility now sets comment_status using Feedback constants to align with read/unread semantics. |
projects/packages/forms/tests/php/contact-form/Contact_Form_Endpoint_Test.php | Extends tests to assert presence/type of is_unread in collection params. |
projects/packages/forms/tests/js/dashboard/store.test.js | Adds tests covering query-keyed counts caching and defaults. |
projects/packages/forms/src/dashboard/store/selectors.js | Selectors now accept query params and use a cache key to return per-query counts. |
projects/packages/forms/src/dashboard/store/resolvers.js | Resolver forwards is_unread and stores results by query key. |
projects/packages/forms/src/dashboard/store/reducer.js | Introduces getCacheKey and changes counts state to a keyed cache; updates optimistic updates to be per-query. |
projects/packages/forms/src/dashboard/store/actions.js | setCounts and updateCountsOptimistically now carry queryParams. |
projects/packages/forms/src/dashboard/inbox/empty-responses.tsx | Empty state accounts for read/unread filter, showing a generic “No results found” message. |
projects/packages/forms/src/dashboard/inbox/dataviews/index.js | Adds “Read status” filter and maps it to is_unread; passes filter to EmptyResponses. |
projects/packages/forms/src/dashboard/inbox/dataviews/actions.js | Ensures optimistic count updates are scoped to the current query; invalidates counts on read/unread changes. |
projects/packages/forms/src/dashboard/hooks/use-inbox-data.ts | Fetches and selects counts per current query, including is_unread. |
projects/packages/forms/src/dashboard/components/response-view/body.tsx | Invalidates counts after marking a single response as read to keep counts accurate. |
projects/packages/forms/src/contact-form/class-feedback.php | Exposes STATUS_UNREAD/STATUS_READ as public constants for reuse. |
projects/packages/forms/src/contact-form/class-contact-form-endpoint.php | Adds is_unread to routes/params; filters counts by comment_status; attempts to filter collection by comment_status. |
projects/packages/forms/changelog/add-forms-unread-filtering | Changelog entry for the feature. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
projects/packages/forms/src/contact-form/class-contact-form-endpoint.php
Show resolved
Hide resolved
projects/packages/forms/src/dashboard/inbox/dataviews/actions.js
Outdated
Show resolved
Hide resolved
Code Coverage SummaryCoverage changed in 11 files. Only the first 5 are listed here.
Full summary · PHP report · JS report If appropriate, add one of these labels to override the failing coverage check:
Covered by non-unit tests
|
projects/packages/forms/src/contact-form/class-contact-form-endpoint.php
Outdated
Show resolved
Hide resolved
projects/packages/forms/src/contact-form/class-contact-form-endpoint.php
Outdated
Show resolved
Hide resolved
projects/packages/forms/src/contact-form/class-contact-form-endpoint.php
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.
We need to follow up to better invalidate/retain results through pagination and read/unread status update, but we can ship this so it doesn't get huge
Currently when you are using the unread/read filter and you mark things as read the pagination breaks. Since the state on the client and the backend is not in sync any more. We fix this by passing in an array of invalid ids. This way the state between the browser and the backend matched and the pagination works as expected.
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 nicely! We'll follow up on any lingering glitches!
This Pr Adds a unread/read filter to the dashboard.

Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions: