Skip to content

fix(chat): fix media message sizing and align caption/bubble width to it - #6616

Merged
mahibi merged 1 commit into
masterfrom
bugfix/noid/improveMediaDimensionsAndPadding
Sep 3, 2026
Merged

fix(chat): fix media message sizing and align caption/bubble width to it#6616
mahibi merged 1 commit into
masterfrom
bugfix/noid/improveMediaDimensionsAndPadding

Conversation

@mahibi

@mahibi mahibi commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Fixes a cluster of related Compose layout bugs in single-media chat messages where the bubble's width, height, and caption wrapping didn't track the actual rendered photo/video:

  • Height cap for extreme aspect ratios: a very tall, narrow image used to render at full natural height, dwarfing the conversation. Height is now capped to a fraction of the screen height, with both width and height scaled together (fittedMediaSize) so the container always matches the image's real aspect ratio — avoiding the mismatched background/border that appeared when only height was capped.
  • Minimum size floor: media is no longer allowed to shrink below a sensible minimum width/height.
  • Bubble no longer wider than its media: the caption text, timestamp/read-receipt row, and quoted-reply header now size against the media's actual resolved width (contentMinWidth, threaded down as an absolute Dp rather than a fraction guessed too early) instead of always filling the bubble — closing the gap that used to appear next to narrow (e.g. portrait) images.
  • Long captions wrap instead of stretching the bubble, but can grow past the media's width up to the bubble's own max width when the media is very thin, so a caption isn't forced to wrap after almost every word.
  • OverlayMetadataBadge fix: the timestamp pill overlaid on captionless photos was being counted by the Box's "widest child" sizing pass, letting it override the media's own (narrower) width; it's now excluded via matchParentSize().
  • Consistent aspect-ratio source: the width fraction used for the caption/quote rows now derives from the same aspect ratio actually used to render the media (falling back to the loaded image's intrinsic ratio when the server doesn't report dimensions), instead of only the server-reported value, which could silently disagree with what was on screen.

Assisted-by: Claude Code:claude-sonnet-5

🖼️ Screenshots

screenshots are a bit off but basically the PR fixes that photos with uncommon dimensions are well displayed instead to mess the messages view.

🏡 After

grafik

🏚️ Before

grafik grafik grafik

🚧 TODO

  • ...

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@mahibi mahibi added this to the 25.1.0 milestone Sep 2, 2026
@mahibi mahibi self-assigned this Sep 2, 2026
@mahibi mahibi added the 3. to review Waiting for reviews label Sep 2, 2026
Fixes a cluster of related Compose layout bugs in single-media chat messages where the bubble's width, height, and caption wrapping didn't track the actual
rendered photo/video:

- Height cap for extreme aspect ratios: a very tall, narrow image used to render at full natural height, dwarfing the conversation. Height is now capped to a
fraction of the screen height, with both width and height scaled together (fittedMediaSize) so the container always matches the image's real aspect ratio —
avoiding the mismatched background/border that appeared when only height was capped.
- Minimum size floor: media is no longer allowed to shrink below a sensible minimum width/height.
- Bubble no longer wider than its media: the caption text, timestamp/read-receipt row, and quoted-reply header now size against the media's actual resolved width
(contentMinWidth, threaded down as an absolute Dp rather than a fraction guessed too early) instead of always filling the bubble — closing the gap that used to
appear next to narrow (e.g. portrait) images.
- Long captions wrap instead of stretching the bubble, but can grow past the media's width up to the bubble's own max width when the media is very thin, so a
caption isn't forced to wrap after almost every word.
- OverlayMetadataBadge fix: the timestamp pill overlaid on captionless photos was being counted by the Box's "widest child" sizing pass, letting it override the
media's own (narrower) width; it's now excluded via matchParentSize().
- Consistent aspect-ratio source: the width fraction used for the caption/quote rows now derives from the same aspect ratio actually used to render the media
(falling back to the loaded image's intrinsic ratio when the server doesn't report dimensions), instead of only the server-reported value, which could silently
disagree with what was on screen.

Assisted-by: Claude Code:claude-sonnet-5

Signed-off-by: Marcel Hibbe <[email protected]>
@mahibi
mahibi force-pushed the bugfix/noid/improveMediaDimensionsAndPadding branch from 514f627 to 5c0c06a Compare September 2, 2026 10:34
@mahibi
mahibi marked this pull request as ready for review September 2, 2026 11:00
@mahibi
mahibi requested a review from rapterjet2004 September 2, 2026 11:00
@mahibi

mahibi commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

/backport to stable-25.0.x

@mahibi
mahibi merged commit f873fc1 into master Sep 3, 2026
16 of 21 checks passed
@mahibi
mahibi deleted the bugfix/noid/improveMediaDimensionsAndPadding branch September 3, 2026 07:58
@backportbot

backportbot Bot commented Sep 3, 2026

Copy link
Copy Markdown

The backport to stable-25.0.x failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable-25.0.x
git pull origin stable-25.0.x

# Create the new backport branch
git checkout -b backport/6616/stable-25.0.x

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick 5c0c06ae

# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/6616/stable-25.0.x

Error: Failed to clone repository: Failed to create working tree: fatal: remote error: GitHub is temporarily limiting some unauthenticated downloads to protect the stability of the platform. Please retry later or authenticate.


Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@mahibi

mahibi commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

/backport to stable-25.0.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews AI assisted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant