Repository navigation
fix(chat): keep a just-left group left when an older group feed lands - #1241
Merged
Merged
Conversation
Follows #1240. Leaving a group while a group feed was in flight was undone when that feed landed: `setMembership(false)` dropped the group's stamp, so `setGroupFeed` saw the stale listing, marked the user joined again, and `replaceGroupFeed` wrote membership=true to the DB. The stamp now records every membership change, join or leave. For a group changed after a feed's `requestedAt` mark, local membership wins: a join is kept, a leave stays un-joined. The left group's row is kept so the screen the user left from can still render its gate, and the controller records only still-joined groups through `replaceGroupFeed`. A feed requested after the change is trusted fully.
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.
Follows #1240, which fixed the join side of this race. A leave has the mirror problem.
Cause
ConversationController.leaveand the roster.leftpath inapplyRosterMembershipcallstore.setMembership(false), which dropped the group's seat stamp.ConversationStore.setGroupFeed(_:requestedAt:)then setjoinedGroupIDs = joined ∪ seatedSince, so the user was a member again.applyGroupFeedpassed the feed toreplaceGroupFeed, which writes membership=true for every group it is given, so the DB kept it until the next fresh feed.Fix
setMembershipstamps every change, join or leave, with a generation.setGroupFeed, for groups changed after the mark, local membership wins: a join stays joined and out ofdeparted; a leave stays un-joined even though the feed lists it. The row stays in the store, since the screen the user left from renders its gate from it.applyGroupFeedpasses only groups the store still counts as joined toreplaceGroupFeed, so the DB does not record membership=true for a just-left group.