Skip to content

fix: add folder deletion UI and proper attachment cleanup#28

Open
kaniamutan14 wants to merge 1 commit intocloudflare:mainfrom
kaniamutan14:main
Open

fix: add folder deletion UI and proper attachment cleanup#28
kaniamutan14 wants to merge 1 commit intocloudflare:mainfrom
kaniamutan14:main

Conversation

@kaniamutan14
Copy link
Copy Markdown

Currently, users can create custom folders, but there was no mechanism to remove them. This introduces a folder deletion workflow that ensures data integrity by cleaning up not only the database records but also the associated physical assets in Cloudflare R2 storage.

Proposed Changes

  • Frontend (UI/UX):
    • Added a trash icon on hover for custom folders in the Sidebar.
    • Implemented a safety confirmation dialog to prevent accidental data loss.
    • Added redirection logic: if a user deletes the folder they are currently viewing, the app automatically navigates them back to the Inbox.
  • Backend (API & DO):
    • MailboxDO: Updated the deleteFolder method to proactively fetch all attachment paths associated with a folder's
      emails before the records are purged via D1 cascade.
    • API Route: Updated the DELETE /folders/:id endpoint to coordinate the "physical" cleanup of R2 blobs,
      preventing storage leaks (orphaned files).
  • Maintenance:
    • Pruned several unused dev dependencies (tsx, yaml, get-tsconfig) to streamline the build environment.

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