Skip to content

fix(message-reader): inlined image not displaying#11082

Open
rafaeltonholo wants to merge 7 commits into
thunderbird:mainfrom
rafaeltonholo:fix/10889/inlined-image-not-displaying-message-reader
Open

fix(message-reader): inlined image not displaying#11082
rafaeltonholo wants to merge 7 commits into
thunderbird:mainfrom
rafaeltonholo:fix/10889/inlined-image-not-displaying-message-reader

Conversation

@rafaeltonholo

@rafaeltonholo rafaeltonholo commented Jun 2, 2026

Copy link
Copy Markdown
Member

Contribution Summary

Fixes: #10889

Description

This PR brings back the attachment list at the bottom of the message. Instead of just reverting the removal of the old one, I've implemented a new one using Compose, since it will be useful in the future when we migrate the Message Reader to Compose.

Changes included:

  • Convert AttachmentViewInfo to Kotlin
  • Added BoxScope to RemoteImage
  • Added the Attachment list back to the message reader
  • Make sure the Attachment header bar is fully clickable, instead of only the View button.

Screenshots

Inlined images only
Inlined images + attached image
Inlined images + attached files/image
Attachments without images
Inlined image AND file attachment (Before download complete message)
Inlined image AND file attachment (After download complete message)
image

AI Disclosure

Select one of the following (mandatory)

  • This contribution does not include any changes created or assisted by AI.
  • This contribution includes changes assisted by AI.
  • This contribution includes changes created by AI.

@rafaeltonholo rafaeltonholo requested a review from a team as a code owner June 2, 2026 19:20
@rafaeltonholo rafaeltonholo requested a review from jbott-tbird June 2, 2026 19:20
@github-actions github-actions Bot added the tb-team Tasks and features handled by project maintainers label Jun 2, 2026
@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Validation Passed: All report and feature-flag labels are correctly set.

@rafaeltonholo rafaeltonholo requested review from dani-zilla and removed request for jbott-tbird June 2, 2026 19:21
@rafaeltonholo rafaeltonholo added the report: include Include changes in user-facing reports. label Jun 2, 2026
@rafaeltonholo rafaeltonholo changed the title Fix/10889/inlined image not displaying message reader fix(message-reader): inlined image not displaying Jun 2, 2026
@rafaeltonholo rafaeltonholo force-pushed the fix/10889/inlined-image-not-displaying-message-reader branch from d16545d to 108e11f Compare June 3, 2026 13:40
@dani-zilla

Copy link
Copy Markdown
Contributor

Sometimes I could get inline images, but other times they appear below. I'm trying to figure out when this happens, but I think it could be down to your account settings, if you always allow images. With this account, I have it set to always allow images, yet the photo I sent ended up below the email, with a divider line where the image should have been between the text.
testEmailInline

That's not to say it doesn't always work:
inlineWorkingThough

@dani-zilla

Copy link
Copy Markdown
Contributor

Sometimes I could get inline images, but other times they appear below. I'm trying to figure out when this happens, but I think it could be down to your account settings, if you always allow images. With this account, I have it set to always allow images, yet the photo I sent ended up below the email, with a divider line where the image should have been between the text.

Looking into this now and I'll come up with a more detailed test plan, but what I found so far is that it is interpreted as a jpeg mimetype and should display. I'll try to piece out which cases fail or if it's from a specific email service.

@dani-zilla

Copy link
Copy Markdown
Contributor
imageSmallEnoughToNotNeedDownload Might have figured out at least one issue. It's not putting the image inline if it's downsized by the email sender. I used my mail client to downsize this image to "Small" when sending so it wouldn't hit the kb threshold for being too large and requiring a separate download.

Also, I found another issue with displaying inline images that are too large. When you download the image and it re-draws to display the image inline, it's HUGE. Too large to fit in the view area. It will either shrink the text to display the entire image if the user has selected the "Auto-fit messages" option in Settings > General > Display. If auto-fit messages is off, it's just a huge image. We may want to consider auto-scaling such images, but perhaps that's out of scope for this fix, as I do believe that was the behavior before we encountered this bug.

…ttachment view data

- Add `AttachmentUiItem` sealed interface with subtypes: `RemoteImage`, `InlinedImage`, `File`, `InlinedFile`
- Add `AttachmentViewInfoMapper` interface for bidirectional mapping between domain and UI layers
- Implement `DefaultAttachmentViewInfoMapper` in legacy core with `AttachmentViewInfo` implementing `AttachmentMetadata`
- Change `message-reader-api` and `message-reader-impl` to use `kmpCompose` plugin
- Add temporary methods to `AttachmentMetadata` to avoid breaking changes with `@JvmField` properties
@rafaeltonholo

Copy link
Copy Markdown
Member Author

Might have figured out at least one issue. It's not putting the image inline if it's downsized by the email sender. I used my mail client to downsize this image to "Small" when sending so it wouldn't hit the kb threshold for being too large and requiring a separate download.

Could you please share with me the .eml file of the email you are experiencing this? This could be how the email sender has built the email.

Also, I found another issue with displaying inline images that are too large. When you download the image and it re-draws to display the image inline, it's HUGE. Too large to fit in the view area. It will either shrink the text to display the entire image if the user has selected the "Auto-fit messages" option in Settings > General > Display. If auto-fit messages is off, it's just a huge image. We may want to consider auto-scaling such images, but perhaps that's out of scope for this fix, as I do believe that was the behavior before we encountered this bug.

I will create a separate issue to investigate this matter. Resizing images in this way would require JavaScript integration, which is disabled in our webview.

@rafaeltonholo rafaeltonholo force-pushed the fix/10889/inlined-image-not-displaying-message-reader branch from 108e11f to eb92f25 Compare June 11, 2026 10:55
…legacy MessageContainerView

- Add `MessageReaderViewModel` to manage attachment state
- Introduce `MessageReaderViewContract` with `State`, `Event`, and `ViewModel` abstraction
- Create `AttachmentCard` composable for rendering attachment UI
- Integrate `AttachmentViewInfoMapper` to map legacy `AttachmentViewInfo` to `AttachmentUiItem`
- Add `MailPart` expect/actual interface to bridge platform-specific attachment types
- Wire up attachment rendering in `MessageContainerView.renderAttachments()` using ComposeView
- Register `MessageReaderViewModel` in Koin DI with `koin-core-viewmodel`
- Add comprehensive unit tests for `MessageReaderViewModel` attachment mapping and filtering logic
…ssues with koinViewModel

- Set ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed on attachment ComposeView
- Inject MessageReaderViewModel at fragment level and pass it down to MessageContainerView instead of using koinViewModel inside ComposeView
@rafaeltonholo rafaeltonholo force-pushed the fix/10889/inlined-image-not-displaying-message-reader branch from eb92f25 to 5e3b7a1 Compare June 11, 2026 12:00
@dani-zilla

Copy link
Copy Markdown
Contributor

I really don't know what to say. I've sent dozens of emails to myself from a variety of accounts. iCloud, Gmail, Thundermail, Proton. I used the Thunderbird desktop client, Gmail on the web, my mail app, the Thunderbird app (can't do inline attachments anyway), and Apple's Mail app on iOS. With the exception of Proton on Android, they all showed up with the inline image at the bottom and a divider line where the image should be. I think it may have to do with what they send through, how they denote its place in the email, whether or not they did resizing with or without my permission, I don't know.

How are you testing that you're not seeing similar results?

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

Labels

report: include Include changes in user-facing reports. tb-team Tasks and features handled by project maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inline images no longer display inline after v18.0 update

3 participants