Skip to content

fix(media): open the attachment that was tapped - #17

Merged
jsfraz merged 1 commit into
developmentfrom
fix/viewer-wrong-attachment
Nov 17, 2026
Merged

jsfraz merged 1 commit into
developmentfrom
fix/viewer-wrong-attachment

Conversation

@jsfraz

@jsfraz jsfraz commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Symptom: tapping an attachment opened a different one (a video in the razj chat), and those attachments were missing from chat info → shared media.

Root cause: the viewer and the shared-media grid both build their list from viewableMedia, which required downloadStatus == ready. Attachments carrying a stale failed/expired flag — left behind by the re-download bug fixed in #15 — were dropped from both lists while the bubbles kept drawing them from their local file. Tapping such a bubble looked up its index in a list that did not contain it, fell back to 0 and opened the newest attachment in the conversation, which happened to be a video.

Fix:

  • A local file is what makes an attachment viewable; the status only decides what to show while there is none. Album items follow the same rule.
  • The viewer no longer falls back to page 0: if the tapped attachment is missing from the list it shows that attachment alone.

Verified on the running debug build (Android emulator, Flutter MCP toolkit + hot reload):

  • same conversation, chat info → shared media: 1 tile before, 7 tiles after;
  • tapping an image tile opens the viewer with an image page, tapping the video tile opens the video player (00:04 / 00:04 controls).

Verification: flutter analyze --no-fatal-infos clean, flutter test 153/153.

The viewer and the chat-info gallery both build their list from
`viewableMedia`, which required `downloadStatus == ready`. Attachments
that carry a stale failed/expired flag (left behind by the old
re-download bug) were therefore missing from both lists, while the
bubbles drew them from their local file anyway. Tapping such a bubble
looked up an index in a list that did not contain it, fell back to 0 and
opened the newest attachment in the conversation — often a video. The
same filter is why those attachments never showed up under shared media.

A local file is what makes an attachment viewable now; the status only
decides what to show while there is none. That also covers album items.

The viewer stops guessing as well: when the tapped attachment is not in
the list it shows that attachment alone instead of page 0.

Verified on the running debug build: the chat-info grid went from one
tile to seven for the same conversation, an image tile opens an image and
the video tile opens the video player.
@jsfraz
jsfraz merged commit 82003ee into development Nov 17, 2026
1 check passed
@jsfraz
jsfraz deleted the fix/viewer-wrong-attachment branch November 17, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant