Repository navigation
fix(chat): don't tell the viewer they received a group's cash - #1497
Merged
Merged
Conversation
A group cash message previews as "You received $25.00" whenever the sender cannot be attributed — the feed carries a truncated roster for a large group, so the sender is often missing from `metadata.members`, and a null `senderId` lands in the same place. The cash went to the group; the viewer may have got none of it. Preview the bare amount instead, which is what the named-sender branch already does apart from the "Alice sent" prefix. `previewText` needs `isGroup` to tell the two unattributed cases apart, so thread it in alongside `sentBySelf` and `senderName`. Matches the reading iOS took in code-payments/code-ios-app#799.
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 group cash message previews as "You received $25.00" whenever the sender cannot be attributed.
previewTextreaches theelsebranch and pickslabel_chat_preview_receivedCash, which is wrong for a group: the cash went to the chat, and the viewer may have got none of it. The comment directly above already says so — the reasoning just never guarded this branch, only thesenderName != nullone.It is reachable, not theoretical. The feed carries a truncated roster subset for a large group, so
metadata.membersoften does not have the sender; a group cash message with a nullsenderIdlands in the same place.The fix: in a group, when the sender cannot be attributed and the message is not
sentBySelf, preview the barelabel— the formatted amount with the "of " suffix where it applies. That is what the named-sender branch already renders apart from its "Alice sent" prefix.previewTextdid not know the chat type, soisGroupis threaded in alongsidesentBySelfandsenderName, including through theMessageContent.Replyrecursion. The self-sent and named-sender branches are unchanged.ChatSummaryPreviewTestgains the cash counterpart of its existinga message from someone the roster subset omits is not prefixed: a group whose last message isMessageContent.Cashfrom an id outsidememberspreviews as$25.00. It fails on the old code — the unstubbedreceivedCashlookup throws — and the module's suite passes with the fix.This came from iOS.
ConversationController.lastMessagePreviewin code-payments/code-ios-app#799 took the same reading for the group cash case, so this closes the divergence rather than opening one.