Conversation
Contributor
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
Contributor
SDK Size Comparison 📏
|
|
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.



Goal
A channel hidden via
channel.hiddenis put back into the channel list by achannel.updatedormember.updatedfor the same channel, and stays there until the app restarts. The remove itself works: in thereported logs the displayed grouped list empties and then has the channel back 38ms later, inside the same event
batch. Neither add path checks whether the channel is hidden.
Closes AND-1530
Implementation
DefaultChatEventHandler.addIfMembershipUpdatedwhen the cached channel is hidden. This is themember.updatedpath, and it is the only one that applies to plain channel lists, since the base handleralready skips
channel.updated.GroupAwareChatEventHandler.routeByGroupwhen the cached channel is hidden, and remove the channel ifit is still listed. This is the
channel.updatedpath; the default group resolver always resolves a channel intothe
allsentinel group, so anallgrouped query took the add unconditionally.hiddenis per-user and absent fromchannel.updatedpayloads, so both guards read the cached channel. Per-channelevent handling runs before query handling in the same batch, so for a channel whose state is active in memory the
flag is current.
parseChatEventResultsfalls back to the database for channels that are not active, and thedatabase is only written after query handling, so on that fallback the guard sees the pre-batch value and does not
fire. Narrowing that gap means filtering hidden where the query map is written rather than per event, which is a
wider change than this fix.
The new-message add paths stay unguarded: a non-shadowed message clears
hiddeninChannelEventHandler, which iswhat makes a hidden channel resurface legitimately.
ChannelMutableState.toChannel()now resolves the current user from theuserFlowit already holds instead of theChatClientsingleton. Same value (StateRegistryis constructed withclientState.user), and it lets the statelayer be exercised without a built client.
Testing
EventHandlerSequentialHiddenChannelTestdrivesEventHandlerSequentialover the realStateRegistryandLogicRegistry. It replays the reported batch (notification.mark_read,channel.hidden,channel.updated,member.updated) against a grouped query, and covers a plain query hidden in one batch and updated in the next.Both fail without the guards. A third case asserts the same batch without the hidden event still adds the channel,
so the assertions cannot pass vacuously, and a fourth asserts a new message brings a hidden channel back.
DefaultChatEventHandlerTestandGroupAwareChatEventHandlerTest, including ahidden channel already in the list being removed.
HideChannel, thenUpdateMemberPartialorUpdateChannelPartial). After each of those calls the backend still excludes the channelfrom that user's
QueryChannelsresponse, so a list that shows it is out of sync with the server.