Show attached images in the Details pane #80

Closed
opened 2026-10-09 09:20:43 -05:00 by deadstyle · 1 comment
Owner

Problem

Images attached to an issue or PR with the forge's attach control (not pasted into the body text) never appear in the Details pane. Issue #79 is the example: empty body, one attached demo-renovate.png. The PM chose to show them (option 2 of the decision on this request).

Acceptance criteria

  • Opening an issue or PR with attached PNG/JPEG/GIF files draws them in the Details pane below the body, using the same sizing, loading, failure-link and "Show images" rules as body images (PM decision; ADR 0016).
  • An attachment whose URL the body already embeds is drawn once, not twice (PM: body images already work).
  • Where images can't draw (unsupported terminal, setting off, loading, failed) an attached image shows as a 🖼 name link, like a body image (ADR 0016).
  • Non-image attachments are not shown (scope: images only).
  • Demo mode is unaffected.

Plan

  • domain: add Attachment{Name, URL string}; Attachments []Attachment on Issue and ChangeRequest.
  • forge/gitea: parse assets (name, browser_download_url) on the issue and pull payloads; keep only names ending .png .jpg .jpeg .gif.
  • ui/details.go: in overview, after the body, build markdown ![name](url) (one paragraph per attachment, name escaped) for attachments not already in markdown.Images(body) (compare URL paths), and render it through the existing md callback so loading/caching/placement reuse the body-image path.
  • Tests: adapter fixture with assets; details test for dedupe and for the link fallback; revert-check that the dedupe test goes red.

Context

  • Live check: GET /issues for #79 returns body: "" and assets: [{name: demo-renovate.png, browser_download_url: https://git.bobparsons.dev/attachments/<uuid>}].
  • Body images already work: internal/ui/details.go:46 markdown() + internal/ui/images.go; fetch is same-origin only through forge.AssetReader (internal/forge/gitea/assets.go), so attachment URLs are fetched with the token.
  • Comments are not shown in Details yet, so comment attachments are out of scope.
  • Technical decision (Opus-level, follows ADR 0016, no new ADR): reuse the body-image pipeline by synthesizing markdown rather than a second image path.

Out of scope

Non-image attachments, comment attachments, uploading attachments.

## Problem Images attached to an issue or PR with the forge's attach control (not pasted into the body text) never appear in the Details pane. Issue #79 is the example: empty body, one attached `demo-renovate.png`. The PM chose to show them (option 2 of the decision on this request). ## Acceptance criteria - Opening an issue or PR with attached PNG/JPEG/GIF files draws them in the Details pane below the body, using the same sizing, loading, failure-link and "Show images" rules as body images *(PM decision; ADR 0016)*. - An attachment whose URL the body already embeds is drawn once, not twice *(PM: body images already work)*. - Where images can't draw (unsupported terminal, setting off, loading, failed) an attached image shows as a `🖼 name` link, like a body image *(ADR 0016)*. - Non-image attachments are not shown *(scope: images only)*. - Demo mode is unaffected. ## Plan - `domain`: add `Attachment{Name, URL string}`; `Attachments []Attachment` on `Issue` and `ChangeRequest`. - `forge/gitea`: parse `assets` (`name`, `browser_download_url`) on the issue and pull payloads; keep only names ending `.png .jpg .jpeg .gif`. - `ui/details.go`: in `overview`, after the body, build markdown `![name](url)` (one paragraph per attachment, name escaped) for attachments not already in `markdown.Images(body)` (compare URL paths), and render it through the existing `md` callback so loading/caching/placement reuse the body-image path. - Tests: adapter fixture with `assets`; details test for dedupe and for the link fallback; revert-check that the dedupe test goes red. ## Context - Live check: `GET /issues` for #79 returns `body: ""` and `assets: [{name: demo-renovate.png, browser_download_url: https://git.bobparsons.dev/attachments/<uuid>}]`. - Body images already work: `internal/ui/details.go:46` `markdown()` + `internal/ui/images.go`; fetch is same-origin only through `forge.AssetReader` (`internal/forge/gitea/assets.go`), so attachment URLs are fetched with the token. - Comments are not shown in Details yet, so comment attachments are out of scope. - Technical decision (Opus-level, follows ADR 0016, no new ADR): reuse the body-image pipeline by synthesizing markdown rather than a second image path. ## Out of scope Non-image attachments, comment attachments, uploading attachments.
Author
Owner

🤖 merged: #81

🤖 merged: https://git.bobparsons.dev/deadstyle/lazyforge/pulls/81
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
deadstyle/lazyforge#80
No description provided.