Update the message read status when the reading member is removed from the channel#6579
Conversation
|
@CodeRabbit review |
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
✅ Action performedReview finished.
|
WalkthroughMember removal now clears the removed user’s channel read state across direct channel updates, current event handling, and legacy event handling. Unit tests cover state cleanup and preservation of other readers, while two end-to-end read-decrement tests are enabled. ChangesMember read-state cleanup
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant MemberRemovedEvent
participant ChannelEventHandlerImpl
participant ChannelStateImpl
MemberRemovedEvent->>ChannelEventHandlerImpl: handle member removal
ChannelEventHandlerImpl->>ChannelStateImpl: removeRead(userId)
ChannelStateImpl->>ChannelStateImpl: remove userId from _reads
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
SDK Size Comparison 📏
|
Head branch was modified
6929913 to
e3321af
Compare
|



Goal
When the only member who read a message is removed from the channel, the message delivery status should fall back from READ (double checkmark) to SENT (single checkmark), because no remaining member has read it. Currently the status stays READ after the
member.removedevent: the member is removed from the state, but their read entry is kept, so both the Compose and XML message lists keep showing the double checkmark. The iOS SDK already behaves correctly by deleting the removed member's read state.Resolves AND-1310
Implementation
On
member.removed, the removed member'sChannelUserReadis now deleted together with the member, in all three places that hold it:ChannelEventHandlerImplcalls the newChannelStateImpl.removeRead(userId).ChannelEventHandlerLegacyImplcalls the newChannelStateLogic.deleteRead(userId), which delegates toChannelStateLegacyImpl.Channel.removeMemberextension (used byEventHandlerSequentialto persist the event) now also filters the removed user's entry out ofChannel.read, so a cold start does not restore the stale READ status.The scope is
member.removedonly, matching the iOS SDK.notification.removed_from_channelandnotification.invite_rejectedare unchanged.Since
MessageListControllercomputes the read status fromChannelState.reads, the fix applies to both the Compose and XML UI kits.The two e2e tests ported in #6572 are no longer ignored and act as the acceptance check:
test_readByDecremented_whenParticipantIsRemovedtest_readByDecrementedInThreadReply_whenParticipantIsRemovedTesting
Manual steps:
The same steps apply to a thread reply (step 2: reply in a thread instead).
Automated coverage:
ChannelStateImpl.removeRead,ChannelStateLegacyImpl.deleteRead, both event handlers, and theChannel.removeMemberextension.:stream-chat-android-client:testDebugUnitTestpasses.Summary by CodeRabbit
Bug Fixes
Tests