Repository navigation
fix(chat): gate cash-card taps on membership and the thank-you on the composer - #1545
Merged
Merged
Conversation
… composer A non-member reading a group could tap a cash card and claim it, and any reader was recorded for a "Thanks for the cash!" reply even when they had no composer to post it from, so the reply went to a send the server rejects. The card now hands its URL to the chat instead of opening it, and State.cashCardTap decides: a viewer outside the group gets a "Join to Collect" sheet and the link stays closed; a member opens it, and the tap is recorded for a reply only when the composer is live. Mirrors iOS (code-ios-app feat/cash-link-claim-reply).
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.
Two guards on cash cards in chat, mirroring what iOS added on
feat/cash-link-claim-reply.No thank-you when the viewer can't post. Android recorded every tap for a "Thanks for the cash!" reply, including from a reader outside the group or in a deactivated DM, where the reply is a send the server rejects. The tap is now recorded only when the composer is live (
!isAnonymous && !replacesComposer). Android has no read-only-member state for speaker rules yet: the composer shows for any member. So "composer is live" is the same test iOS runs at its.opengate.Non-members can't claim from the card. An eligible non-member reads the group sharp and can see a cash card. Tapping it now shows "Join to Collect" / "Join this chat to collect cash sent in it." and does not open the link, so it never reaches
openCashLinkand records no reply. The copy matches iOS and is provisional there too. Members, including one whose join checkmark is still showing, claim as before.To make that possible,
MessageBubbleno longer opens a cash link itself.ChatAction.CashLinkOpenednow carries the URL, andMessengerScreenopens it only whenState.cashCardTapsaysCollect.This guards the card tap only. The URL is still in the message text, and a non-member can copy it and claim it anywhere. Whether the server should refuse that claim is a separate question.
Tests:
ChatViewModelStateTestcoverscashCardTapfor members, DMs, eligible/blocked/unknown non-members, a deactivated DM, and the join-checkmark frame.