Skip to content

feat(ui): (optional) Protect starred media from accidental deletion - #9458

Open
FloeHetling wants to merge 2 commits into
invoke-ai:mainfrom
FloeHetling:qol_2026q2/starred-protector
Open

FloeHetling wants to merge 2 commits into
invoke-ai:mainfrom
FloeHetling:qol_2026q2/starred-protector

Conversation

@FloeHetling

@FloeHetling FloeHetling commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor
  • new settings option: "Protect starred media"
  • when protection is enabled, following features will be active:
  • there will be impossible to delete an image or video with Star mark. If "Confirm on delete" is enabled, a warning toast will appear on said attempt (silent otherwise)
  • upon attempting to use "Delete Board, Images & Videos" option, additional confirmation will be issued if said board has at least one media item with Star mark
  • upon agreeing, marked media will be kept and moved to "Uncategorized", while the board and unmarked media will be deleted
  • upon attempting to delete a group selected of images or videos, media marked with Star will not be touched and a toast about protection status will be thrown if "Confirm on delete" is enabled (silent otherwise)
  • same behavior should be expected from "Delete All Uncategorized Images/Videos" option
  • protection is disabled by default and existing deletion clients keep the old behavior

Summary

  • new settings option: "Protect starred media"
  • the option is disabled by default, so the usual deletion behavior is left unchanged
  • when protection is enabled, following features will be active:
  • there will be impossible to delete an image or video with Star mark. If "Confirm on delete" is enabled, a warning toast will appear on said attempt (silent otherwise)
  • upon attempting to use "Delete Board, Images & Videos" option, additional confirmation will be issued if said board has at least one image or video with Star mark
  • upon agreeing to delete such board, the board and all unmarked media will be deleted. Starred images and videos will be kept and moved to "Uncategorized"
  • upon attempting to delete a group selected of images or videos, media marked with Star will not be touched and a toast about protection status will be thrown if "Confirm on delete" is enabled (silent otherwise)
  • same behavior should be expected from "Delete All Uncategorized Images/Videos" option
  • the protection is enforced by backend image and video services. Existing clients keep the old behavior unless they explicitly request starred media protection
  • failed deletion and media skipped due to protection are reported separately, so frontend selection and cached media are only cleaned for items that were actually deleted

Related Issues / Discussions

This is a complete re-work of #8406, done from scratch relying on latest unified gallery, video deletion and multi-user board changes.
The feature was carefully rebased/reworked onto V7 webv2 stack.

QA Instructions

Careful. This test implies some of the images and videos can or will be eventually lost. For safety of your artwork, consider using testing environment

  • have some images and videos to start test with, 10x media items should be enough
  • open Gallery settings (gear icon in the Gallery header), click "All Gallery settings…" and enable the "Protect starred media" option. It is placed next to "Confirm image deletion"
  • mark 2 images with Star, then select 3 images, 2 of which are marked and 1 is not. Press the Delete key or use Delete icon in selection bar. Expected behavior: confirmation dialog asks about 1 image only, and after confirming one unmarked artwork is deleted, while both marked images are left untouched
  • repeat the previous step with videos. Expected behavior: only unmarked videos should be deleted
  • enable "Confirm image deletion" and attempt to delete a marked image or video. Expected behavior: no deletion dialog, the media should stay untouched and an info toast about protection should appear. Disable "Confirm image deletion" and repeat the attempt: the media should still be protected, but without the toast
  • with "Confirm image deletion" enabled, delete a selection of marked and unmarked media. Expected behavior: the toast says how many items were deleted and how many marked were kept. With "Confirm image deletion" disabled there is only the usual "Deleted" toast
  • create a new board and move one marked image and one marked video there. Add one unmarked image and one unmarked video. Open board menu and choose "Delete Board". Expected behavior: the dialog shows a warning line with a number of starred items that will be moved to "Uncategorized" instead of being deleted. There is no separate second confirmation anymore, the warning is part of this dialog
  • choose "Delete Board and Media". Expected behavior: the board and both unmarked items should be gone. The marked image and video should be left untouched and moved to "Uncategorized". The toast mentions how many starred items were kept
  • choose "Delete Board Only" on another board with marked media (protection enabled). Expected behavior: usual behavior, the board is deleted and all its media is moved to "Uncategorized"
  • disable "Protect starred media" and delete the remaining marked items. Expected behavior: the usual deletion behavior should be restored and starred media should be deleted. The board delete dialog has no warning line in this mode

Merge Plan

No special merge plan should be needed. The feature was completely re-done from scratch on top of latest main instead of reusing the old implementation. Generated OpenAPI schema and frontend API types are included in the PR.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • !Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions Bot added api python PRs that change python files services PRs that change app services frontend PRs that change frontend files python-tests PRs that change python tests labels Aug 4, 2026
@FloeHetling
FloeHetling marked this pull request as ready for review August 4, 2026 07:55
@lstein lstein added the 7.0.0 label Aug 8, 2026
@lstein lstein moved this to 7.0 Theme: Tabbed Layout UI in Invoke - Community Roadmap Aug 8, 2026
@FloeHetling

Copy link
Copy Markdown
Contributor Author

@Pfannkuchensack
on it, I'll analyze and adapt the branch over current main

@FloeHetling

Copy link
Copy Markdown
Contributor Author

on it, will provide resolve till the weekend

@FloeHetling
FloeHetling force-pushed the qol_2026q2/starred-protector branch 2 times, most recently from a1ad648 to a76cd7a Compare September 4, 2026 16:46
@FloeHetling
FloeHetling force-pushed the qol_2026q2/starred-protector branch from a76cd7a to c239b02 Compare September 19, 2026 21:00
@FloeHetling

Copy link
Copy Markdown
Contributor Author

@Pfannkuchensack on par with main again, all green, locally tested

@FloeHetling
FloeHetling force-pushed the qol_2026q2/starred-protector branch from c239b02 to a05dd0d Compare September 24, 2026 09:12
@FloeHetling

Copy link
Copy Markdown
Contributor Author

V7 retarget is planned for tomorrow

@FloeHetling
FloeHetling force-pushed the qol_2026q2/starred-protector branch from a05dd0d to 3a5f39e Compare October 6, 2026 23:05
@github-actions github-actions Bot added the docs PRs that change docs label Oct 6, 2026
Comment thread invokeai/app/services/shared/bulk_media_delete.py

@joshistoast joshistoast left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

concurrent star updates can bypass deletion protection, and partially successful deletions can clear project references to protected media.


if (result.succeeded.length === 0) {
// Nothing went away (every item was refused or kept), so the widget values cleared up front come back too.
restoreGalleryItemRemoval(galleryWidgetSnapshot);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Restore protected widget references on partial success

With stale cached star information, a mixed request can delete one item while the backend protects another. Optimistic removal has already cleared both items from Gallery state and Upscale/Video inputs across projects. The protected item’s query cache is restored, but widget references are restored only when nothing succeeded. Restore protected survivors’ references during partial success while keeping deleted items removed.

Add a "Protect starred media" setting (off by default). While it is on, deleting images or videos skips starred ones, and deleting a board with its media moves starred items to Uncategorized instead.
Add `delete_starred` to the image, video and board delete endpoints and report skipped items in `starred_skipped`; clients that omit it keep the old behavior.
Protected deletes now refuse starred rows in the same transaction that removes the records, so a star set while files were being staged keeps its record and its files are restored. Applies to single, batch and board deletes of images and videos.
Starred-only deletes without confirmation now say nothing was deleted; the board dialog notice names the button it applies to and handles loading and errors.
@FloeHetling
FloeHetling force-pushed the qol_2026q2/starred-protector branch from 3a5f39e to 7431ec3 Compare October 14, 2026 06:38
@FloeHetling

Copy link
Copy Markdown
Contributor Author

concurrent star updates can bypass deletion protection, and partially successful deletions can clear project references to protected media.

yup, found, examined and addressed that in my latest update, thank you!

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

7.0.0 api docs PRs that change docs frontend PRs that change frontend files python PRs that change python files python-tests PRs that change python tests services PRs that change app services

Projects

Status: 7.0 Theme: Modular Design

Development

Successfully merging this pull request may close these issues.

3 participants