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

Refactor Mark all as read in notifications #20649

Merged
merged 4 commits into from
Apr 17, 2024
Merged

Conversation

jarvislin
Copy link
Contributor

@jarvislin jarvislin commented Apr 17, 2024

Refactor #20066

The previous implementation used a loop to make API requests to mark each note as read, this will be like DDoS if many users are marking their notes read at the same time. The new implementation only uses one API request to mark all notes as read.


To Test:

  1. Sign in the JP app
  2. Switch to the notifications tab
  3. Create some unread notifications
  4. Click the three dots icon at the top-right corner
  5. Click Mark all as read
  6. The unread dots should be cleared
  7. Done, thank you!

Regression Notes

  1. Potential unintended areas of impact

    • Notifications
  2. What I did to test those areas of impact (or what existing automated tests I relied on)

    • Manual
  3. What automated tests I added (or what prevented me from doing so)

    • Added some unit tests

PR Submission Checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Testing Checklist (strike-out the not-applying and unnecessary ones):

  • WordPress.com sites and self-hosted Jetpack sites.
  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • Talkback.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • Large and small screen sizes. (Tablet and smaller phones)
  • Multi-tasking: Split screen and Pop-up view. (Android 10 or higher)

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Apr 17, 2024

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr20649-ffaf5de
Commitffaf5de
Direct Downloadwordpress-prototype-build-pr20649-ffaf5de.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Apr 17, 2024

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr20649-ffaf5de
Commitffaf5de
Direct Downloadjetpack-prototype-build-pr20649-ffaf5de.apk
Note: Google Login is not supported on these builds.

@jarvislin jarvislin added this to the 24.8 milestone Apr 17, 2024
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link

codecov bot commented Apr 17, 2024

Codecov Report

Attention: Patch coverage is 48.57143% with 18 lines in your changes are missing coverage. Please review.

Project coverage is 40.46%. Comparing base (0384227) to head (ffaf5de).
Report is 9 commits behind head on trunk.

Files Patch % Lines
...notifications/utils/NotificationsActionsWrapper.kt 0.00% 11 Missing ⚠️
...src/main/java/org/wordpress/android/models/Note.kt 0.00% 3 Missing ⚠️
...oid/ui/notifications/NotificationsListViewModel.kt 89.47% 0 Missing and 2 partials ⚠️
...va/org/wordpress/android/util/ToastUtilsWrapper.kt 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            trunk   #20649   +/-   ##
=======================================
  Coverage   40.46%   40.46%           
=======================================
  Files        1484     1485    +1     
  Lines       68413    68441   +28     
  Branches    11307    11312    +5     
=======================================
+ Hits        27683    27696   +13     
- Misses      38230    38244   +14     
- Partials     2500     2501    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jarvislin jarvislin requested a review from antonis April 17, 2024 07:45
@jarvislin jarvislin marked this pull request as ready for review April 17, 2024 07:46
Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

Awesome work @jarvislin!
The app works as expected for me and the code changes look good 🎉
Thank you for this refactoring and for adding tests🏅
If I'm not mistaken #20247 also works as expected now. Feel free to close that too if that's the case :)

@antonis antonis merged commit 9eb7b2d into trunk Apr 17, 2024
24 checks passed
@antonis antonis deleted the refactor/mark-all-notes-read branch April 17, 2024 10:21
Copy link

sentry-io bot commented Apr 17, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ ApplicationNotResponding: Background ANR org.wordpress.android.datasets.ReaderTagTable i... View Issue
  • ‼️ ApplicationNotResponding: ANR org.wordpress.android.datasets.ReaderPostTable ... View Issue

Did you find this useful? React with a 👍 or 👎

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

Successfully merging this pull request may close these issues.

3 participants