Skip to content

fix(chat): render photo captions like text messages - #1839

Merged
bmc08gt merged 6 commits into
code/cashfrom
feat/chat-caption-link-cards
Oct 23, 2026
Merged

bmc08gt merged 6 commits into
code/cashfrom
feat/chat-caption-link-cards

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

A photo caption doesn't render like the same text sent as a message. A text message with a group, profile or tip link draws the Flipcash card, an emoji-only one draws jumbo emoji, and long-press offers Copy. A caption got none of that.

  • ChatPhotoBubble draws the caption with the text message's components: BareLinkCard for a Flipcash link, placed with position.withPhotoAbove(), and JumboEmoji for an emoji-only caption. BareLinkCard, JumboEmoji and CASH_CARD_WIDTH_FRACTION go from private to internal in MessageBubble.kt.
  • splitAroundLinkCard keeps a group invite, user or message card on a photo row. A caption that is only the link draws the card under the photo. With words around it, LinkCard.captionRowsAround splits the caption with the same marginsIn and saysSomething rules the text path uses: the words with the link removed, then the card, then any words after the link.
  • Copy is offered on a captioned photo and copies the whole caption, link included, as it does for a text message with a card.
  • Cash and token links with words around them stay caption text.
  • A web link gets no card, and a LinkCard.Web on a photo row is dropped before resolution. Neither app attaches a link preview to a caption: when the composer has one, the photo and the text go out as two messages, and that doesn't change here.

Tests are in MediaCaptionCardTest, MediaCaptionMentionTest and SplitAroundLinkCardTest.

iOS counterpart: code-payments/code-ios-app#1124.

A photo's caption was drawn as a text body but never read as one: linkableText() and
linkPreview() returned null for Media, so no link card was classified and a
sender-built preview was ignored. Both now read the caption (a photo reply reads its
photo's caption, not the reply's own text), and the photo bubble draws the existing
web link card under the caption, widening to the bubble width once it has a preview.
Flipcash cash and message cards are not drawn for captions: they split a bubble into
rows, which a photo has none of.
Copy is offered for a photo, or a reply carrying one, whose caption is non-empty; edit
stays off since it would have to re-seal the image. ChatListItem.plainText follows the
caption, and splitAroundLinkCard leaves a photo alone for any non-web card.
A redacted caption is hidden as a redacted text body is.
A caption now gets the card a text message with the same text gets, including a
Flipcash cash or message card, which draws under the caption in the slot the web
card uses and takes the same claim and tap handling. A cash link ahead of a web
link no longer leaves the caption with no card. A caption that is only its link
is the card alone with no caption row, and an emoji-only caption is drawn large
with no bubble, as in a text message.
Drop the wrapper shape and padding that drew a Flipcash card inside the
caption bubble. A Flipcash card now draws only when the caption is just the
link, through BareLinkCard as in text. With words around it, text splits the
prose into rows around the card, which a photo row cannot do without new UI,
so the caption draws as text with no card.
Senders never attach a preview to a caption (the text goes out as its
own message) and the mapper drops caption link previews, so a caption's
web card was never resolved and the branch was unreachable. Remove the
WebLinkCard/BareWebCard drawing from the photo bubble, return the
helpers widened only for it to private, and drop its tests. A web card
on a photo row is now dropped when the row is split.
A photo caption with words around a group invite, profile or tip link
showed the raw link and no card. It now splits as the same text message
does: the caption text with the link removed, the card under it, and any
text after the link in a bubble below the card. Cash and token links
still draw as caption text unless they are the whole caption.
@bmc08gt bmc08gt self-assigned this Oct 23, 2026
@github-actions github-actions Bot added the type: fix Bug fix label Oct 23, 2026
@bmc08gt
bmc08gt merged commit 2554f5c into code/cash Oct 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant