Skip to content

Conversation

enejb
Copy link
Member

@enejb enejb commented Oct 15, 2025

This Pr Adds a unread/read filter to the dashboard.
Screenshot 2025-10-15 at 2 25 30 PM

Proposed changes:

  • Adds filters for count and feedback endpoints. To only return data that is specific to the filter.
  • Update the UI to make it possible to filter.
  • Update the count store to use a key that matches the currentQuery so that the results are what you would expecte always.
  • Invalidate the count store when feedback is marked and unmarked with the count. So that the count stays accurate.

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:

  • Go to dashboard.
  • Apply the unread filter. For both states ( unread and read ) and notice that you get the results that you would expect.
  • Apply the filter for data and notice that it still works as expected. The same goes for source.
  • Clear all filters and notice that the count works as expected.
  • Mark things as read and unread and notice that the count looks like you would expected in the tabs.

Copy link
Contributor

github-actions bot commented Oct 15, 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!

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Oct 15, 2025
@enejb enejb force-pushed the add/forms-unread-filtering branch from 8afbb6b to e5e1f70 Compare October 15, 2025 21:56
@enejb enejb added [Status] Needs Review This PR is ready for review. [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Oct 15, 2025
@enejb enejb requested review from a team and Copilot October 15, 2025 21:57
Copy link
Contributor

github-actions bot commented Oct 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/forms-unread-filtering branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/forms-unread-filtering

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

Copy link
Contributor

@Copilot 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

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.

Copy link

jp-launch-control bot commented Oct 15, 2025

Code Coverage Summary

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

File Coverage Δ% Δ Uncovered
projects/packages/forms/src/dashboard/inbox/dataviews/actions.js 0/189 (0.00%) 0.00% 34 💔
projects/packages/forms/src/contact-form/class-contact-form-endpoint.php 729/856 (85.16%) -2.07% 24 💔
projects/packages/forms/src/dashboard/hooks/use-inbox-data.ts 35/63 (55.56%) 3.38% 6 💔
projects/packages/forms/src/dashboard/components/response-view/body.tsx 0/105 (0.00%) 0.00% 4 💔
projects/packages/forms/src/dashboard/store/reducer.js 33/53 (62.26%) 12.26% 4 💔

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

CGastrell
CGastrell previously approved these changes Oct 16, 2025
Copy link
Contributor

@CGastrell CGastrell left a 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

enejb added 3 commits October 17, 2025 06:11
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.
Copy link
Contributor

@CGastrell CGastrell left a 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! :shipit:

@enejb enejb merged commit bf1d20a into trunk Oct 17, 2025
67 of 68 checks passed
@enejb enejb deleted the add/forms-unread-filtering branch October 17, 2025 21:09
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label Oct 17, 2025
enejb added a commit that referenced this pull request Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Contact Form [Package] Forms [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.

3 participants