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

Reader Comments: Implement moderation actions #17629

Merged
merged 3 commits into from
Dec 7, 2021

Conversation

dvdchr
Copy link
Contributor

@dvdchr dvdchr commented Dec 6, 2021

Refs #17476
Depends on #17623

This PR adds functionality to the moderation menu items.

  • After a comment is moderated, it should be removed from the table view after the request succeeds.
  • Note that this only hides the moderated comment. The correct behavior is that all descendants of non-approved comments should be hidden, but the API request still returns approved descendants which could cause data inconsistency. Therefore I'll hold off on this implementation until we can also align with the backend side.
  • I've also updated the ReaderPost's comment count (decrementing it by 1) when a comment is moderated.
    • Note that I've decided not to implement the other way around – i.e. incrementing the ReaderPost's comment count when the comment is approved through My Site > Comments. This is because I feel like it's less noticeable since the action is performed from different tabs, and the comment count will eventually get updated if the user opens the post or comment thread.

To test

  • Ensure that the newCommentThread flag is enabled.
  • Navigate to Reader > any comment thread that you can moderate.
  • Tap on the ellipsis button, and select "Unapprove".
  • Verify that the comment is removed from the table view, and a notice is shown.
  • Go back to Reader.
  • Verify that the comment count in the Reader list is decremented by one.
  • Repeat the steps above for "Mark as spam", and "Move to trash" actions.

Regression Notes

  1. Potential unintended areas of impact
    n/a. Feature is hidden behind a flag.

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    n/a. Feature is hidden behind a flag.

  3. What automated tests I added (or what prevented me from doing so)
    n/a. Feature is hidden behind a flag.

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • 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.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Dec 6, 2021

You can trigger an installable build for these changes by visiting CircleCI here.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Dec 6, 2021

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@ScoutHarris
Copy link
Contributor

I noticed one small issue that probably pre-dates your changes.

  • In the threaded view, moderate a comment. It disappears as expected.
  • Select the My Site tab (i.e. don't navigate back via the nav bar).
  • Go to Comments and approve the comment (or any comment in that thread I suppose).
  • Select the Reader tab.
  • Since the last Reader view you looked at was threaded comments, it is still displayed. But the newly approved comment is not.

It would be nice to refresh the view in viewWillAppear instead of viewDidLoad. I didn't fully test it, but a quick test shows it might just be a matter of moving the [self refreshAndSync] call.

Copy link
Contributor

@ScoutHarris ScoutHarris left a comment

Choose a reason for hiding this comment

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

I left one suggestion for consideration. Otherwise 👍 !

:shipit:

@dvdchr
Copy link
Contributor Author

dvdchr commented Dec 7, 2021

It would be nice to refresh the view in viewWillAppear instead of viewDidLoad. I didn't fully test it, but a quick test shows it might just be a matter of moving the [self refreshAndSync] call.

Thanks for the suggestion! Also, this way the comment count for the post will be correct since we're syncing once the user comes back to the thread. This is addressed in 84490b6. 🙂

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.

2 participants