Skip to content

PhoenixKit 1.7.98: A trash for deleted media files

PhoenixKit 1.7.98 adds a trash to the media library. Deleting a file now moves it to the trash, where it can be restored, instead of removing it from storage at once.

The media sidebar has a Trash entry with a count. From there you can Restore selected files, delete one for good, or Empty Trash. On a file’s page, Move to Trash replaces the old permanent delete. Folders are still deleted outright. A daily job at 3 AM deletes trashed files older than the trash_retention_days setting, 30 days by default.

You can also drop files from your computer straight onto the folder content area to upload them there, and reloading the page keeps the folder you were in. A media browser embedded with a folder scope can no longer restore or empty trashed files outside that scope.

Upgrading

Run mix phoenix_kit.update for the V99 migration. New installs get the cleanup job in their Oban crontab; on an existing app, add {"0 3 * * *", PhoenixKit.Modules.Storage.Workers.PruneTrashJob} to the Oban.Plugins.Cron crontab yourself, or trashed files stay until emptied by hand.

Full release notes: PhoenixKit 1.7.98

1.7.98 · 16 April 2026

Added

  • V99 migration: trashed_at column on phoenix_kit_files with partial index for soft-delete (PR #497)
  • Media trash bucket: soft-delete files with restore/empty/permanent-delete actions and sidebar count badge
  • PhoenixKit.Modules.Storage.Workers.PruneTrashJob — daily Oban cron (3 AM) that permanently deletes files older than trash_retention_days (default 30)
  • Drag-drop upload: drop device files directly onto the folder content area (FolderDropUpload JS hook)
  • URL-param hydration on first mount so reloads don’t flash the root view

Fixed

  • Scope guard on restore_selected in MediaBrowser — a scoped embed could previously restore files outside its scope via a crafted toggle_select payload
  • Trash view, permanent-delete, and empty_trash now respect scope_folder_id via recursive CTE
  • list_files/1 excludes trashed files
  • Breadcrumb and search bar moved inside card body so padding matches grid/list content

PhoenixKit 1.7.98. Install or update: {:phoenix_kit, "~> 1.7"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.