Skip to content

feat: a comment keeps the media pasted into it - #7

Draft
bchbib wants to merge 1 commit into
eigenpair:mainfrom
bchbib:feat/comment-attachments
Draft

bchbib wants to merge 1 commit into
eigenpair:mainfrom
bchbib:feat/comment-attachments

Conversation

@bchbib

@bchbib bchbib commented Dec 1, 2026

Copy link
Copy Markdown

Draft - the Rust part is not compiled. I wrote it without a Rust toolchain on my machine, so cargo build, fmt, clippy and the tests have not run. Please treat the Rust changes as a worked-out proposal that may need fixing; CI on this PR is their first build. The UI part is type-checked and tested in the browser as far as a 1.1.4 daemon allows (see below).

Description

Problem. In a ticket's comment box I can paste an image, and it is previewed under the box. But it is attached to the ticket, not to the comment: after sending, the comment shows only its text, and the image is one more entry in the ticket's attachment list at the bottom. A comment like "it didn't work, see the image I attached" loses what it points at - and with several such comments nobody can tell which image belonged to which.

Change. A comment carries attachments of its own, the way a forum post already does.

  • Core: Comment gets attachments: Vec<Attachment>, serialized only when non-empty, so existing ticket files do not change and older tickets load as before. New ops::add_comment_with_attachments; ops::add_comment keeps its signature (all its callers are untouched). One unit test.
  • Daemon: POST /api/tickets/{id}/comments accepts an optional attachments array - media staged with POST /api/media, validated with the same checked_media as forum posts.
  • Board UI:
    • media pasted into the comment box is staged, shown under the box as "Attached to this comment" (each item removable), and sent with the comment;
    • a comment shows its media as thumbnails under its text; a click opens the full-screen preview (same look as in the forum);
    • an image alone can be sent as a comment;
    • the ticket's own attachment list is no longer touched by a paste into the comment box.

Not in this PR

  • A local file path pasted into the comment box still attaches that file to the ticket, as today (there is no staging-by-path route).
  • No CLI flag yet (wipe comment add --attach <file> would be the natural follow-up for agents), and wipe ticket show does not list a comment's media in its plain output; the JSON output carries them through serde.
  • Deleting a comment leaves its media file in .wipe/media/, like detaching does.

How I tested

  • UI: svelte-check 0 errors, 0 warnings. In the browser (Vite dev UI against wipe serve 1.1.4, throwaway board, Windows 11, Chromium): pasting an image into the comment box stages it and shows it under the box, the ticket's attachment list and activity stay unchanged, and sending posts { body, attachments: [...] } and clears the box.
  • Not testable against 1.1.4: that daemon drops the attachments field, so I could not see a saved comment render its media. That path (Comment.attachments in the ticket JSON -> thumbnails) is untested.
  • Rust: not built, not tested (see the note at the top).

Checklist

  • I've described the change and the motivation above
  • Tests were added or updated to cover this change (or N/A, with reason) - one core test, a_comment_keeps_its_attachments; not run
  • cargo fmt passes with no diff - not run
  • cargo clippy --workspace --all-targets -- -D warnings passes - not run
  • cargo test --workspace passes - not run
  • All .wipe writes still go through wipe-core's deterministic
    serializer (no ad-hoc JSON serialization added)
  • The PR title follows Conventional Commits
    (e.g. feat(cli): add wipe ticket archive command)

🤖 Generated with Claude Code

An image pasted into a ticket's comment box was attached to the ticket,
not to the comment: after sending, the comment showed only its text and
the image was one more entry in the ticket's attachment list. A comment
like "it didn't work, see the image" lost what it pointed at.

Comments now carry attachments of their own, the way forum posts do.

- core: Comment.attachments (omitted from the ticket file when empty, so
  existing tickets are unchanged) and ops::add_comment_with_attachments,
  with a test. ops::add_comment keeps its signature.
- daemon: POST /api/tickets/{id}/comments accepts `attachments` (media
  staged with POST /api/media, checked like a forum post's).
- board UI: media pasted into the comment box is staged, previewed under
  the box as "Attached to this comment" (removable), and sent with the
  comment; a comment shows its media as thumbnails under its text and a
  click opens the full-screen preview. An image alone can be sent as a
  comment. The ticket's own attachment list is no longer touched.

A local file path pasted into the comment box still attaches that file
to the ticket, as before.

NOT COMPILED: written without a Rust toolchain. The Rust part is
unbuilt and untested; the UI part is type-checked (svelte-check).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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