Skip to content

Conversation

enejb
Copy link
Member

@enejb enejb commented Oct 2, 2025

Fixes FORMS-302

Adds new feedback/read endpoint and the new UI that lets you mark feedback as read and unread.

Screenshot 2025-10-02 at 7 38 58 AM

This new state is shown as a dot. this is due to the current limitation of the data views which prevent the whole row from being bold.

Proposed changes:

  • Adds a new endpoints for marking feedback responses from being read or unread.
  • Add UI changes so that you see unread feedback responses as read.
  • Add the ability to mark responses as read or unread.

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 FORMS-302

Does this pull request change what data or activity we track or use?

No

Testing instructions:

  • Add a form and fill it out.
  • Notice that this response will show up as unread in the forms UI.
  • Notice that you mark previous responses as read and unread.

@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 Oct 2, 2025
@enejb enejb changed the title Add/forms unread state Forms: add read/unread state to the UI Oct 2, 2025
Copy link
Contributor

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

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

@github-actions github-actions bot added [Feature] Contact Form [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests labels Oct 2, 2025
Copy link
Contributor

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


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

Copy link

jp-launch-control bot commented Oct 2, 2025

Code Coverage Summary

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

File Coverage Δ% Δ Uncovered
projects/packages/forms/src/dashboard/inbox/dataviews/actions.js 0/122 (0.00%) 0.00% 36 💔
projects/packages/forms/src/dashboard/inbox/response.js 0/140 (0.00%) 0.00% 19 💔
projects/packages/forms/src/dashboard/inbox/utils.js 0/13 (0.00%) 0.00% 8 💔
projects/packages/forms/src/dashboard/inbox/dataviews/index.js 0/156 (0.00%) 0.00% 6 💔
projects/packages/forms/src/contact-form/class-contact-form-endpoint.php 630/708 (88.98%) 0.18% 5 💔

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.

Copy link
Contributor

@edanzer edanzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tests fairly well and is an exciting change to see.

The good:

  • Once this PR is loaded, any new form responses show as unread (with red dot).
  • Interacting with unread messages updates status to read (no more dot)
  • Selecting items in bulk and clicking the "Mark unread" button successfully marks them unread (with red dot).
  • Using the actions dropdown for a single response to mark an item read or unread works.
  • Tests pass

Potential improvements:

  • The dot in my testing is small and red. I like the bigger, blue one in the PR description a bit more :). It is a shame we can't otherwise style the un-read item rows more (ie, bolding or background color).
  • Could be done in a follow up, but now that feedback objects have an unread property, I wonder if we could use that to determine the number we show in the notifications bubble in the admin menu for Jetpack and Forms. As is, these are totally unconnected.
    • Example: Say I have 5 unread messages and I see that button Jetpack and Forms. Soon as I click the inbox, that gets cleared even though I still have unread messages. Also marking message read or unread also doesn't affect that.
  • There's a small TS error that needs resolving.
unread-status

@enejb
Copy link
Member Author

enejb commented Oct 2, 2025

Thanks for the review @edanzer!

should we should the red bubble.

Yes we should. This part needs updating. ( I think we should switch to a new option ) and go and update the total unread, Everytime we add a new response and when we switch the read state. Ideally this value would also change as we update the count live on the page.

I updated design to be indicate that the Response is unread by making the different elements bold.
It looks like this now. cc @ilonagl.

Screenshot 2025-10-03 at 12 21 46 AM

@simison simison force-pushed the add/forms-unread-state branch from bd305b5 to 1e06088 Compare October 4, 2025 12:31
CGastrell
CGastrell previously approved these changes Oct 4, 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.

Works great! :shipit:

*/
public static function recalculate_unread_count() {
$count = Feedback::get_unread_count();
update_option( 'feedback_unread_count_v2', $count );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use jetpack_ prefix since we're renaming anyway. 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some pre-loading also happening with jetpack_ prefixed options, some different helper functions, and perhaps they get synced automatically?

@ilonagl
Copy link

ilonagl commented Oct 7, 2025

Screenshot 2025-10-07 at 16 59 47

Could we make the dot the same color (#d63638) as the notification bubble, so it's easier to connect the dots (no pun intended haha)?

@ilonagl
Copy link

ilonagl commented Oct 7, 2025

Other than that, it works great!

enejb and others added 6 commits October 8, 2025 05:43
Replaces legacy unread feedback count logic with new static methods in Contact_Form_Plugin and Feedback classes, storing the count in a new option. Updates backend to recalculate and return the unread count after marking feedback as read/unread. Frontend now updates the admin menu counter dynamically using the new count from the server, improving accuracy and consistency.
@enejb enejb force-pushed the add/forms-unread-state branch from bdccb87 to ea73e41 Compare October 8, 2025 13:37
default: // 'publish' (inbox) or any other status
return (
<>
{ response.is_unread && (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these actions be available to all, inbox/spam/trash views? 🤔

simison
simison previously approved these changes Oct 8, 2025
Copy link
Member

@simison simison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing overall well; tested also combined counts with and without unread form responses:

Screenshot 2025-10-08 at 17 06 52 Screenshot 2025-10-08 at 17 13 15

In a follow-up, let's iterate on +/-:ing sidebar counter optimistically (#45398) instead of having a delay or have counter not work when starting form zero.

Let's also refresh counts when unread posts are moved as-is to trash, or marked as spam. I don't think we should have those in the counter, only inbox-unreads. In this example count is 3, but one unread is in trash:

Screenshot 2025-10-08 at 17 22 51

Copy link
Contributor

@edanzer edanzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just retested following latest changes. Everything that was working before is working now but now with other nice improvements.

  • I like the bolding for unread items!
  • Great to see the syncing between unread items and the notification bubble on the Jetpack/Forms dashboard menu.
  • Single response action buttons to mark unread are working great.

Improvements:

  • The only small issue I'm seeing is that there can be a delay between when I read an item / mark an item unread and when I see the number in the menu notification bubble change. I assume that's some delay due to need to round trip an endpoint request to update the notification count. Probably something we should improve, but it could easily be handled in a follow up.
  • UPDATE: Can also confirm from other findings, that if you mark an unread item as spam or trash, the number on the dashboard menu doesn't change. Didn't notice this initially because normally I'd read an item before marking it spam or trashing it.
  • Still some failing tests / static analysis issues

@simison
Copy link
Member

simison commented Oct 8, 2025

The only small issue I'm seeing is that there can be a delay between when I read an item / mark an item unread and when I see the number in the menu notification bubble change.

Yep, started on improving it here:

@enejb enejb merged commit 97a59da into trunk Oct 8, 2025
66 of 67 checks passed
@enejb enejb deleted the add/forms-unread-state branch October 8, 2025 20:17
@github-actions github-actions bot added this to the jetpack/15.2 milestone Oct 8, 2025
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label Oct 8, 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 [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [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.

5 participants