RS unified comment detail screen - #23051
Merged
Merged
Conversation
Replace the abandoned unified comment detail stub with a working screen for the site-comments path: view, moderation (approve/unapprove, spam, trash), like, edit, and reply. The list auto-refreshes via the local comment cache. Convert the UNIFIED_COMMENTS_DETAILS gate from a remote/build @feature flag to a debug-only Experimental Feature, and drop the now-unused config + BuildConfig field. Adds ViewModel unit tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Format the comment date as a relative time span via DateTimeUtilsWrapper - Open the post in the Reader when the post title is tapped - Approve an unapproved comment when replying to it (legacy parity) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Copy the comment link to the clipboard - Share the comment link via a chooser - Permanently delete a trashed/spam comment, with confirmation Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Reuse the shared reader comment box for the reply input, adding: - @-mention user suggestions (WP.com-accessed sites) - full-screen reply expand - per-comment draft autosave, cleared after a successful send Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Register UnifiedCommentDetailsViewModel in ViewModelModule (fixes a crash when opening the screen: "View model not found") - Use explicit text sizes so the comment text is readable (the Material3 textAppearance attrs didn't resolve in this activity's theme) - Handle toolbar up navigation so the back arrow works - Replace the action buttons with the legacy icon-button footer (Approve / Spam / Like / More), moving Edit, Trash, Copy link, Share and Delete permanently into the More overflow Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the unused binding field (inline the inflate) and the no-op component().inject(this) call — the activity injects nothing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Style the footer's moderate and like buttons per state like the old comment detail: accent-tinted icon + label at full opacity when on (approved / liked), colorOnSurface at medium opacity when off. Approved comments now read "Approved" rather than "Unapprove", and trashed comments show "Restore" with the undo icon. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add CommentsRsDataSource (load/moderate/trash/delete/reply via the wordpress-rs /wp/v2/comments endpoint, like postsrs/pagesrs) and rewrite UnifiedCommentDetailsViewModel to use it. FluxC is kept for liking (rs has no comment like action) and to resync the still-FluxC comment list cache after each rs write. Tests updated to mock the rs data source. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Use a generic key (rs_unified_comments) so the flag can also gate a future wordpress-rs comment list, label it "RS Unified Comment Detail", and base the description on the New Pages List one (WP.com + application-password sites). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Generated by 🚫 Danger |
Contributor
|
|
Contributor
|
|
Use INVISIBLE (not GONE) for the scroll view during load so its weighted space is preserved, and show the Spam button up front instead of only once the comment has loaded. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Log the swallowed share ActivityNotFoundException, suppress the intentional generic catch and guard-clause return count (matching the existing rs code), and drop an unused test import. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #23051 +/- ##
==========================================
+ Coverage 37.53% 37.58% +0.04%
==========================================
Files 2327 2328 +1
Lines 125628 125829 +201
Branches 17253 17320 +67
==========================================
+ Hits 47159 47289 +130
- Misses 74632 74668 +36
- Partials 3837 3872 +35 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Return an RsResult carrying WpError.errorMessage from CommentsRsDataSource writes and show that server message on moderation/reply failures (falling back to the generic string). Extract the rs<->app comment status mapping to testable functions and add CommentsRsStatusMapperTest. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Use the comment's GMT date for relative time so it's correct on non-UTC sites (WpGmtDateTime is an absolute Date; the local date field had no offset) - Guard onReplyClicked against a second in-flight reply - Remove the comment from the FluxC cache on permanent delete instead of leaving an orphaned "deleted" row (new CommentsStore.removeCommentByRemoteId) - Drop the fragment's redundant currentState shadow; read uiState.value directly Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…backs Extract the repeated no-network check into an isOffline() helper, collapse the onConfirm/onCollapse null guards, and fix an import ordering. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…etwork The rs comment detail loads over the network, so guard in the activity's onCreate: when offline, show a toast and finish before the screen appears. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
It was mapped from the rs response but never read (createReply uses the comment's remote id as the parent). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
nbradbury
marked this pull request as ready for review
July 1, 2026 14:42
Some sites reject DELETE ?force=false with "Invalid parameter(s): force". Route trash through update(status=trash) like spam/approve, and drop the now-unused CommentsRsDataSource.trash(). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Tint the Trash and Delete permanently more-menu items and the "Trashed" status label with the error colour, matching the legacy comment detail. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
Clauide is pointing some potential bugs. Could you have a look at them and see if they are false positives? |
- Ignore moderation taps while the comment is still loading: the footer stays visible during load and the default ui state would compute (and apply server-side) the wrong target status - Hide the Like button on self-hosted application-password sites, where FluxC's likeComment always fails (legacy canLike parity) - Don't open the Reader from the post title when the site has no WP.com blog id (self-hosted app-password sites), since it can't resolve the post - Guard onLikeClicked against a second tap while a like is in flight, matching the existing reply guard Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Don't reset the ui state when refreshing after an edit: moderation/like during the reload acted on a default status (wrong toggle direction), and a failed refresh blanked the screen and force-closed it - Fall back to the legacy detail on sites the rs client can't authenticate (no WP.com REST and no application password), like the rs pages gating - Render the comment body with the shared comment HTML renderer (inline images, emoticons, whitespace trim) and tappable links, and only re-parse when the HTML changes - Confirm before trashing, since the rs path commits immediately and has no undo affordance like the legacy list flow - Run the offline bail-out only on first launch so rotating/restoring an already-loaded screen while offline doesn't kill it - Key reply drafts and the full-screen dialog tag by the local site id; the WP.com blog id is 0 for all self-hosted app-password sites, which collided drafts across sites Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
This was referenced Jul 2, 2026
This file contains hidden or 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
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.


Description
This PR is the first of several to complete the abandoned Unified Comments project and update it to use
wordpress-rs. Here we add the unified comment detail screen, which was never worked on by the previous team.The unified comment detail screen supports viewing, moderation (approve/unapprove, spam, trash, delete), reply (with @-mention suggestions, full-screen expand and draft autosave), like, edit, and a copy/share more-menu — styled to match the legacy comment detail.
Known limitations (to resolve when the comment list also moves to wordpress-rs):
Testing instructions
Requires a WP.com or self-hosted application-password site.
Enable the feature:
Open and act on a comment: