Skip mark-read when the server tracks none of the loaded messages - #6654
Skip mark-read when the server tracks none of the loaded messages#6654gpunto wants to merge 2 commits into
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. Walkthrough
ChangesRead-state eligibility
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The change narrows mark-read suppression to channels with no server-tracked messages and adds focused coverage for the affected cases; no actionable merge-blocking risk remains after normal checks and review. Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |



Goal
Develop port of #6646. The mark-read guard from #6644 skips whenever the last item in the list is the current user's own local-only message, which also suppresses legitimate mark-read in channels the server does have messages for. An
errormessage is terminal, so a rejected or moderation-bounced send stays the last item and keeps those channels unread indefinitely.Skip only when the server tracks none of the loaded messages. Read state leaves out our own not-yet-persisted messages, and silent and shadowed ones from anyone, so none of them can resolve a mark-read call. Silent is documented as not marking a channel unread, so a channel holding only silent messages has nothing to mark read.
Part of AND-1395
Implementation
MessageListController.markLastMessageReadInternal: replace the "last item is our own local-only message" check with "no loaded message is one the server tracks", via a newMessage.isInServerReadStatepredicate covering local-only,silentandshadowed.randomMessagerandomisessilent, which the gate now keys on, so the gate-dependent tests and thenowMessagehelper pin it explicitly. This includes the two unread-label tests that only exist here, one of which asserts state computed inside the branch the gate guards.Testing
ui-commonsuite rerun to confirm the gate no longer depends on a randomised field.last_read_message_id.Summary by CodeRabbit