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

Comment details trash moderation redesign #20952

Conversation

jarvislin
Copy link
Contributor

@jarvislin jarvislin commented Jun 7, 2024

Implemented
https://github.com/Automattic/wordpress-mobile/issues/41
https://github.com/Automattic/wordpress-mobile/issues/40

This PR contains features related to comment moderation. The changes mostly are in the moderation bottom sheet. Every action button is implemented on the bottom sheet in this PR.

Screenshot 1 Screenshot 2
Screenshot_20240610-212609 Screenshot_20240610-212626

To Test:

  1. Sign in JP app
  2. Go to Notifications
  3. Click on a notification with type Comment
  4. Open the comment menu by clicking the ... icon
  5. Click on Change status
  6. Test the functionality of every action
  7. They should work correctly, and the UI is as the design on Figma
  8. Go to My site -> More -> Comments
  9. Click on a comment
  10. Repeat step 4 - 7.
  11. Done, thank you!

P.S. It will update the moderation status UI directly if the comment is from a notification (not including deletion action). But it will finish the screen if the comment is from the comment list.


Regression Notes

  1. Potential unintended areas of impact

    • notifications, comments
  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)

    • n/a

PR Submission Checklist:

skipped


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

skipped

@dangermattic
Copy link
Collaborator

1 Warning
⚠️ strings.xml files should only be updated on release branches, when the translations are downloaded by our automation.
1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jun 7, 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
Versionpr20952-d0fa51a
Commitd0fa51a
Direct Downloadwordpress-prototype-build-pr20952-d0fa51a.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jun 7, 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
Versionpr20952-d0fa51a
Commitd0fa51a
Direct Downloadjetpack-prototype-build-pr20952-d0fa51a.apk
Note: Google Login is not supported on these builds.

Copy link

codecov bot commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 40.98%. Comparing base (78a2b09) to head (d0fa51a).
Report is 62 commits behind head on feature/notifications_refresh_p2.

Files Patch % Lines
...ress/android/ui/comments/CommentDetailViewModel.kt 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                         Coverage Diff                          @@
##           feature/notifications_refresh_p2   #20952      +/-   ##
====================================================================
- Coverage                             40.98%   40.98%   -0.01%     
====================================================================
  Files                                  1523     1523              
  Lines                                 69626    69628       +2     
  Branches                              11515    11516       +1     
====================================================================
  Hits                                  28534    28534              
- Misses                                38504    38505       +1     
- Partials                               2588     2589       +1     

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

Copy link

sonarcloud bot commented Jun 10, 2024

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

@@ -687,33 +690,14 @@ private void moderateComment(
// Fire the appropriate listener if we have one
if (note != null && mOnNoteCommentActionListener != null) {
mOnNoteCommentActionListener.onModerateCommentForNote(note, newStatus);
dispatchModerationAction(site, comment, newStatus);
mViewModel.dispatchModerationAction(site, comment, newStatus);
} else if (mOnCommentActionListener != null) {
mOnCommentActionListener.onModerateComment(comment, newStatus);
// Sad, but onModerateComment does the moderation itself (due to the undo bar), this should be refactored,
Copy link
Contributor Author

@jarvislin jarvislin Jun 10, 2024

Choose a reason for hiding this comment

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

According to this comment, we cannot dispatchModerationAction when the comment is from comment list. So I keep the current behavior, every time we moderate the comment, it will finish the screen (when it is from comment list).

Copy link

Choose a reason for hiding this comment

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

Sounds good 👍

} else if (mOnCommentActionListener != null) {
mOnCommentActionListener.onModerateComment(comment, newStatus);
// Sad, but onModerateComment does the moderation itself (due to the undo bar), this should be refactored,
// That's why we don't call dispatchModerationAction() here.
}
}

private void dispatchModerationAction(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to view model

@@ -687,33 +690,14 @@ private void moderateComment(
// Fire the appropriate listener if we have one
if (note != null && mOnNoteCommentActionListener != null) {
mOnNoteCommentActionListener.onModerateCommentForNote(note, newStatus);
dispatchModerationAction(site, comment, newStatus);
mViewModel.dispatchModerationAction(site, comment, newStatus);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When the comment is from a notification, we can dispatchModerationAction so it can update the comment status without leaving the screen.

P.S. When DELETE a comment, it will finish the screen after the deletion.

@jarvislin jarvislin marked this pull request as ready for review June 10, 2024 19:26
@jarvislin jarvislin requested a review from antonis June 10, 2024 19:27
Copy link

@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 code looks great and the app worked as expected in various configurations on a Pixel 8 / Android 14 🎉

@antonis antonis merged commit 34a279c into feature/notifications_refresh_p2 Jun 11, 2024
22 checks passed
@antonis antonis deleted the issue/Comment-Details-Trash-moderation-redesign branch June 11, 2024 11:28
@antonis
Copy link

antonis commented Jun 11, 2024

@jarvislin Just noticed a minor detail we may handle separately. When spamming a comment the UI still reads Comment in Trash. This aligns with the screenshot of https://github.com/Automattic/wordpress-mobile/issues/40 but the text states:
1‍⃣ The moderation status is changed to "Comment in Spam" text with a dedicated icon that is similar to the one from the moderation bottom sheet (0‍⃣)

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.

4 participants