fix(chat): stop deactivating tip DMs that have no name or phone - #1336
Merged
Conversation
The identity gate that decides whether a DM stays usable was written out twice, and the copies disagreed. `FeedSyncDelegate.feed` applies it only to `CONTACT_DM`; the deactivation collector in `ChatViewModel` applied it to every chat. A tipper who has never set a display name therefore appeared in the tips list and then opened read-only, on `DeactivatedChatBottomBar` with no composer. A tip DM is addressed by user id. The counterparty has no phone by design, and a claimed `@handle` names them, so the gate has nothing to protect there. Extract `isDmAddressable(chatType, counterparty)` into `services/flipcash` and route both call sites through it. The conversation now combines the members flow with its chat type, and an unresolved type — `UNKNOWN`, which is what a chat reports until its kind settles — is left open, so the composer can't flash deactivated before the type arrives.
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.
A tipper who has never set a display name shows up in the tips list, and then opens read-only —
DeactivatedChatBottomBar, no composer, no way to reply.The gate that decides whether a DM stays usable was written out twice, and the copies disagreed:
FeedSyncDelegate.feedapplies it only toCONTACT_DM.ChatViewModelapplied it to every chat, soEvent.ChatDeactivated(isReadOnly = true)fired for a tip DM whose counterparty had no name and no verified phone.The gate is right for a contact DM: that chat is reached through the phone number and named from the device contact, so losing both leaves nothing to address. A tip DM is reached by user id, has no phone by design, and is named by the counterparty's
@handle— there is nothing there for the gate to protect.What changed
isDmAddressable(chatType, counterparty)moves intoservices/flipcashas the single rule, and both call sites route through it.The conversation's collector now combines the members flow with
state.chatType, so the gate is type-aware. An unresolved type is left open — a chat reportsUNKNOWNuntil its kind settles, and gating on that would flash the deactivated composer before the type arrives.Tests
DmAddressabilityTestcovers both directions of each branch, including the two cases that were the bug (a tip DM with only a handle, and one with nothing at all) and theUNKNOWNcase.shared:chat's existingFeedSyncCombinedFeedTestcovers the feed side unchanged.