Skip mark-read when the only messages are deleted - #6658
Conversation
(cherry picked from commit 0483fa6)
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. WalkthroughThe controller now excludes server-deleted messages from server-read eligibility while retaining messages deleted only for the current user. Tests add deterministic fixtures and cover both deletion states. ChangesMessage read state
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change skips mark-read for channels containing only deleted messages while preserving current-user-only deletion behavior; no actionable merge-blocking risk remains after normal checks and review. Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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 |
andremion
left a comment
There was a problem hiding this comment.
Looks good. One test note and one comment-wording question inline, both optional.
|
|
🚀 Available in v6.42.0 |



Goal
v6 port of the deleted-message case from #6654, which came out of review there after #6646 had merged.
The server removes a deleted message from its read state (
HandleMessageDeletedcallsChannelMessagesDelete), and nothing on our side keeps a soft-deleted message out of the message list, so a channel whose only message was deleted still reachedmarkReadwith nothing for the server to resolve, and the emittedmessage.readcarried nolast_read_message_id.Part of AND-1395
Implementation
deletedAt == nullto theMessage.isInServerReadStatepredicate the mark-read gate keys on. Deleted for the current user only does not count, since the message stays in the channel for everyone else and the server can still resolve the read state.randomMessagerandomisesdeletedAtas well assilent, so gate-dependent tests build their messages through atrackedMessagehelper that pins both, instead of pinning each field at every call site.Testing
Unit tests as above, with the
ui-commonsuite rerun to confirm the gate no longer depends on randomised fields.Summary by CodeRabbit