[Notifications P2] Commen Moderation
Fixes #https://github.com/Automattic/wordpress-mobile/issues/34 Fixes #https://github.com/Automattic/wordpress-mobile/issues/35 Fixes #https://github.com/Automattic/wordpress-mobile/issues/36
Description
This PR connects the moderation actions to Network along with tracks. It also improves the loading state for the buttons.
I moved a bunch of code from CommentDetailViewController to CommentModerationViewModel. We should follow that up with tests to make it nicer since now it is possible. I'll try to do another PR for some tests.
Screen Recording
https://github.com/wordpress-mobile/WordPress-iOS/assets/15968946/acb3d1ff-9183-497a-a018-cb8a54bc6b25
Testing Steps
Install & Login to Jetpack App Navigate to Notifications
Every test step will proceed from this point.
Approve Comment
- Select a Pending State notification
- Tap on "Approve Comment"
- β Expect the state to change to "Approved" and moderation UI to update.
- Verify Track: π΅ Tracked: notifications_comment_approved
Like & Unlike
- Select an Approved Notification
- Tap on "Like" button.
- β Expect the button to update to a Liked state.
- Verify Track: π΅ Tracked: notifications_comment_liked
- β Go back and verify if the notification appears liked in the Notifications screen.
- β Unlike the notification from the list and tap on it again. Verify if the state matches in the Detail screen.
Trash
- Tap on the β’β’β’ context menu from the detail screen.
- Change Status
- Select "Trash"
- β Verify the UI to update and button title should read "Delete Permanently".
- β Tap on Delete. Expect the comment to be deleted and navigate back to the notifications list.
- Verify Track: π΅ Tracked: comment_trashed
- β Verify that the notification is not listed there either.
Spam
- Tap on the β’β’β’ context menu from the detail screen.
- Change Status
- Select "Spam"
- β Verify the UI to update and button title should read "Delete Permanently".
- β Tap on Delete. Expect the comment to be deleted and navigate back to the notifications list.
- Verify Track: π΅ Tracked: comment_trashed
- β Verify that the notification is not listed there either.
PR submission checklist:
- [x] I have completed the Regression Notes.
- [x] I have considered adding unit tests for my changes.
- [x] I have considered adding accessibility improvements for my changes.
- [x] I have considered if this change warrants user-facing release notes and have added them to
RELEASE-NOTES.txtif necessary.
Testing checklist:
- [ ] WordPress.com sites and self-hosted Jetpack sites.
- [ ] Portrait and landscape orientations.
- [ ] Light and dark modes.
- [ ] Fonts: Larger, smaller and bold text.
- [ ] High contrast.
- [ ] VoiceOver.
- [ ] 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)
- [ ] iPhone and iPad.
- [ ] Multi-tasking: Split view and Slide over. (iPad)
| 1 Warning | |
|---|---|
| :warning: | This PR is larger than 500 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews. |
Generated by :no_entry_sign: Danger
π² You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
| App Name | WordPress Alpha |
|
| Configuration | Release-Alpha | |
| Build Number | pr23225-85386dd | |
| Version | 24.8 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 85386dd8a130fe5f81aa99d2ca283e3b9d71c938 | |
| App Center Build | WPiOS - One-Offs #9983 |
π² You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
| App Name | Jetpack Alpha |
|
| Configuration | Release-Alpha | |
| Build Number | pr23225-85386dd | |
| Version | 24.8 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 85386dd8a130fe5f81aa99d2ca283e3b9d71c938 | |
| App Center Build | jetpack-installable-builds #9033 |
Hey @alpavanoglu,
I've noticed a UI glitch in the moderations view where the hosting view doesn't properly resize when the state changes. While the SwiftUI view itself resizes, the hosting view fails to adjust accordingly. Here's how you can reproduce the issue:
- Have a comment in either the Trash or Spam state.
- Navigate to that notification comment.
- Change its status to "Approved."
- Observe that the view height doesn't adjust correctly.
- Go back to the previous screen.
- Navigate to the same comment again.
- Notice that the view height is now correct.
This resizing issue occurs when changing to any state but is most noticeable when switching between "Approved" and "Trash/Spam."
I encountered a similar issue in the past, and it was tricky to adjust the hosting view's height without breaking the animation. I think a simple fix for our case would be to set a fixed height for all states.
| Actual | Expected |
|---|---|
Hey, @salimbraksa This resizing issue seem to only happen when I directly open a trashed comment and approve it from the menu. But doesn't happen when I open an approved comment, trash it, approve it, trash so on and so forth. So it does work but something breaks when we first open a trashed state comment. That tells me that we should be able to solve this somehow without assigning fixed heights as they don't work great with dynamic fonts.
One more minor thing is a clickable comment's author bar between Comment Approved and Like comment sections. It's clickable but is not actionable. Are there any plans for that or we can disable the click animation?
If you mean the reply component, that will be replaced with the new reply component once it is built.