-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: Fix comments being misplaced after parent comment is moderated #18094
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Generated by 🚫 dangerJS |
ScoutHarris
approved these changes
Mar 9, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice to add a release note. Otherwise 👍 .
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #18081
This PR fixes the orphaned comments issue by "hiding" (or showing) the comment's replies after it is moderated. This follows the behavior on the web where the comment's thread is entirely hidden when it is not approved (or shown if it is).
Some implementation notes:
visibleOnReader
property onComment
to control whether the comment should be visible on the thread. This is because the comment thread is displayed withNSFetchedResultsController
.visibleOnReader
property is assigned whenever the user visits the comment thread. Note that the screen downloads the comments every time the page is visited, so the value is guaranteed to be correct whenever the user visits the thread.visibleOnReader
instead of callingrefreshAndSync
after each moderation:refreshAndSync
is that it downloads all comments and removes all the non-approved ones.refreshAndSync
after unapproving a comment, it will be deleted from Core Data and we'll have no way to undo the deletion of that one specific comment.Also, I've noticed some additional issues in Reader Comments that is not addressed in this PR:
To test:
Prepare a post with comments structured as described in #18081:
Scenario 1: Moderating from Reader Comments
B
by tapping on the contextual menu.B
,C
, andD
are hidden.B
,C
, andD
are now shown.Scenario 2: Moderating from My Sites while the comment thread is opened
B
,C
, andD
.B
.B
,C
, andD
are hidden.Regression Notes
Potential unintended areas of impact
Comments not being displayed correctly in the comment threads.
What I did to test those areas of impact (or what existing automated tests I relied on)
Manually tested the changes.
What automated tests I added (or what prevented me from doing so)
N/A.
PR submission checklist:
RELEASE-NOTES.txt
if necessary.