Skip to content
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

Notifications: Refresh admin menu after changing comment status #95443

Merged
merged 7 commits into from
Oct 22, 2024

Conversation

phcp
Copy link
Contributor

@phcp phcp commented Oct 16, 2024

Closes #94909

Proposed Changes

  • Refresh admin menu after updating comment status
    • It follows the same approach as the actions on the Comments page (client/my-sites/comments/comment/comment-actions.jsx:87)
    • It needed to include action handlers on the Calypso client, as the Notifications component is implemented on the apps directory and doesn't share the same store

Why are these changes being made?

  • Updating comment status doesn't update the comments count on the admin menu; it includes approving, marking as spam, and deleting

Testing Instructions

  1. Apply this PR to your local or use a test env
  2. Update site setting to hold comments for moderation (Settings > Discussion > A comment is held for moderation)
  3. Go to the Calypso home for the testing site (or any other page inside Calypso)
  4. On an incognito tab (or another session), comment on a post from the test site
  5. Open the notifications panel
  6. You should see a notification for the new comment
  7. Click on the notification and approve the comment
  8. The comment count on the admin menu (sidebar) should update
  9. Comment again and now click on Spam in the notification
  10. The count on the admin menu (sidebar) should update after the undo state completes (~5 seconds later)
  11. Do the same for the Trash action, and the count should also update as expected

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@phcp phcp self-assigned this Oct 16, 2024
@matticbot
Copy link
Contributor

matticbot commented Oct 16, 2024

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Async-loaded Components (~123 bytes added 📈 [gzipped])

name                              parsed_size           gzip_size
async-load-calypso-notifications       +408 B  (+0.2%)     +123 B  (+0.2%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@phcp phcp force-pushed the fix/comments-stale-count branch 2 times, most recently from d5fe390 to d2d26f3 Compare October 16, 2024 22:21
@matticbot
Copy link
Contributor

matticbot commented Oct 16, 2024

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • notifications

To test WordPress.com changes, run install-plugin.sh $pluginSlug fix/comments-stale-count on your sandbox.

@phcp phcp changed the title Notifications: Update comments count after updating comment status Notifications: Update comments count after changing comment status Oct 16, 2024
@phcp phcp marked this pull request as ready for review October 16, 2024 23:01
@phcp phcp changed the title Notifications: Update comments count after changing comment status Notifications: Refresh admin menu after changing comment status Oct 16, 2024
@phcp phcp requested a review from a team October 21, 2024 14:47
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Oct 21, 2024
Copy link
Contributor

@andregardi andregardi left a comment

Choose a reason for hiding this comment

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

Looks good to me.
We had a long slack discussion on that p1729519003872409-slack-C02TCEHP3HA, but seems to be resolved now.

@phcp phcp merged commit a81de44 into trunk Oct 22, 2024
11 checks passed
@phcp phcp deleted the fix/comments-stale-count branch October 22, 2024 16:37
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Comments show (1) with 0 unapproved comments
3 participants