Skip to content

Open attachments from the draft composer - #2002

Open
ferivoq wants to merge 1 commit into
UCSLabs:mainfrom
ferivoq:feat/open-draft-attachment
Open

ferivoq wants to merge 1 commit into
UCSLabs:mainfrom
ferivoq:feat/open-draft-attachment

Conversation

@ferivoq

@ferivoq ferivoq commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

What changes for the person using MailCraft

While writing a message, double-click an attachment, choose Open from its context menu, or select it and press Enter. This opens the copy attached to the draft in the default desktop app so you can check it before sending. In the browser, it downloads that copy. The draft stays open with its attachment in place.

The action works in the reading pane, in pop-out composers, and after reopening a saved draft. It uses the same file checks as opening received attachments. For file types that ask first, the confirmation applies to the exact attached copy.

How it was checked

  • All 14 local cargo xtask ci checks passed, including the browser build.

  • Five regression tests cover pointer and keyboard opening, separate removal, saved drafts, two drafts with the same filename, browser downloads, and stale confirmations.

  • Verified the attachment handoff with a sample mailbox in light and dark and tested the native desktop build.

  • cargo xtask ci passes

  • Allow edits by maintainers

  • Contributor CLA signed

Screenshots

Light

Light theme showing Open in the draft attachment menu

Dark

Dark theme showing Open in the draft attachment menu

Human-reviewed, AI-assisted, nobody's mailbox harmed.

Summary by CodeRabbit

  • New Features
    • Open draft attachments for review before sending by double-clicking an attachment or choosing Open from its menu. In a browser, the menu downloads a copy instead.
    • Attachments that require a safety confirmation are checked again before opening, helping prevent opening a changed file.

Open the attached copy through the existing attachment checks and desktop launcher, or download it in the browser. Keep approval bound to the file shown in the prompt.

Human-reviewed, AI-assisted, nobody's mailbox harmed.
@ferivoq
ferivoq requested a review from benandez as a code owner November 26, 2026 20:44
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds draft-attachment opening through the compose UI. The command validates the draft attachment, applies file-type and confirmation checks, and opens the attachment or downloads it when host opening is unavailable. Translation catalogs and a release note add related strings and guidance.

Changes: Draft Attachment Opening

Layer / File(s) Summary
Command registration and availability
crates/engine/src/agent.rs, crates/ui-egui/src/lib.rs
The command catalog documents ui.openDraftAttachment and its parameters. The command is enabled when the compose has attachments and an open or download service is available. Agents cannot run the command.
Draft validation and attachment handoff
crates/ui-egui/Cargo.toml, crates/ui-egui/src/attachment_open.rs
Draft opening validates the compose ID and attachment index, checks file type and confirmation identity, and reads the attachment. The shared handoff uses the host file opener when available, or downloads the bytes. Confirmation identity includes the attachment name and SHA-256 digest.
Compose actions, confirmation, and tests
crates/ui-egui/src/compose.rs, crates/ui-egui/src/compose/attachment_tests.rs, crates/ui-egui/src/dialogs.rs
Attachment chips provide open or download actions and send the compose ID and attachment index. Confirmation dispatch handles draft attachment opening. Tests cover UI activation, draft and attachment validation, stored attachment bytes, and download behavior.
Localized strings and release note
crates/i18n/po/*, packaging/release-notes.d/new/open-draft-attachment.md
Translation catalogs add draft attachment actions and related errors, with some entries translated and others left empty. The release note describes opening a draft attachment and the browser download behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant ComposeUI
  participant AttachmentOpen
  participant ComposeState
  participant HostOpenFile
  participant BrowserDownload
  ComposeUI->>AttachmentOpen: Send compose ID and attachment index
  AttachmentOpen->>ComposeState: Resolve draft attachment
  ComposeState-->>AttachmentOpen: Return attachment
  AttachmentOpen->>AttachmentOpen: Validate file type and confirmation identity
  alt Host open_file is available
    AttachmentOpen->>HostOpenFile: Pass filename and attachment bytes
  else Download is available
    AttachmentOpen->>BrowserDownload: Pass filename and attachment bytes
  end
Loading

Suggested reviewers: kad26

Merge Risk: Minimal · up to 27494 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "Open attachments from the draft composer" matches the main change. The PR adds a way to open draft attachments from the compose window by double-click, context menu, or Enter, and the raw s…
Description check Passed The description follows the template's main sections. It explains what changes for the user, lists the checks run, and ticks the template checklist items. The CLA and maintainer-edit boxes are ticked,…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Open attachments from the draft composer" matches the main change. The PR adds a way to open draft attachments from the compose window by double-click, context menu, or Enter, and the raw summary confirms this through the attachment_open.rs, compose.rs, and lib.rs changes.

Full details: Description check

Explanation

The description follows the template's main sections. It explains what changes for the user, lists the checks run, and ticks the template checklist items. The CLA and maintainer-edit boxes are ticked, and the 'Closes #' issue line is left out. The 'Builds on' line is not needed for a single-part change. The description also adds a screenshots section that the template does not include.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 756df9e and 274943f.

Files ignored due to path filters: 6

  • Cargo.lock is excluded by !**/*.lock
  • docs/control-protocol.md is excluded by !docs/**
  • docs/log.d/ROADMAP/progress/open-draft-attachment.md is excluded by !docs/**
  • docs/log.d/docs/control-protocol/revisions/open-draft-attachment.md is excluded by !docs/**
  • docs/log.d/docs/ui-parity/revisions/open-draft-attachment.md is excluded by !docs/**
  • docs/ui-parity.md is excluded by !docs/**
Files selected for processing: 20

  • crates/engine/src/agent.rs
  • crates/i18n/po/cs.po
  • crates/i18n/po/de.po
  • crates/i18n/po/es.po
  • crates/i18n/po/fr.po
  • crates/i18n/po/hu.po
  • crates/i18n/po/it.po
  • crates/i18n/po/ka.po
  • crates/i18n/po/messages.pot
  • crates/i18n/po/nl.po
  • crates/i18n/po/pl.po
  • crates/i18n/po/ro.po
  • crates/i18n/po/zh_CN.po
  • crates/ui-egui/Cargo.toml
  • crates/ui-egui/src/attachment_open.rs
  • crates/ui-egui/src/compose.rs
  • crates/ui-egui/src/compose/attachment_tests.rs
  • crates/ui-egui/src/dialogs.rs
  • crates/ui-egui/src/lib.rs
  • packaging/release-notes.d/new/open-draft-attachment.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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