Media: deleting a PDF used by a playlist fails with a generic error #155
Labels
No labels
Area/Backend
Area/Database
Area/Docs
Area/Frontend
Area/Infra
Area/Security
Area/Tests
Area/Tooling
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Lang/Python
Lang/Rust
Lang/Shell
Lang/SQL
Lang/TypeScript
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Routing
Auto
Routing
Hold
Routing
Human
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage#155
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Deleting a PDF (or any media) that a playlist still uses fails, and the panel says only "Could not delete that item. Try again."
Cause (read in the code, GRI-1960)
DELETE /api/v1/media/{id}answers 409media_in_usewhile any playlist item references the document or one of its pages (crates/server/src/media/handlers.rsdelete_media, FK fromplaylist_items.media_id).frontend-web/src/screens/MediaScreen.tsxhandleDeletecatches every error and shows the same generic text. "Try again" can never succeed, and the user is not told why.Done when
Field feedback from the product owner on GRI-1960.
Backend contract for this fix (implementing both sides myself since the task
was routed whole and no backend partner was assigned; flag here if you'd
rather it shaped differently before merge):
DELETE /api/v1/media/{id}keeps its409 media_in_useon conflict, butthe body now carries an optional
detailsfield —{"playlists": [{"id", "name"}, ...]}— naming every playlist that still references the item,directly or through one of its pages.
ApiErrorgaineddetails: Option<serde_json::Value>,skip_serializing_ifnone, so every otherendpoint's error body is byte-identical to before.
DELETE /api/v1/media/{id}?remove_from_playlists=trueremoves thereferencing playlist items and deletes the media in one transaction — the
panel's "Remove from these playlists and delete" confirm.
plan/server/rest-api.mdupdated (Shape row, and the Media table row).media_integration.rscover a document usedthrough a page, and a plain image used directly, each checking the 409
names the playlist and that
remove_from_playlists=truedetaches anddeletes.
Frontend:
MediaScreen.tsxnow shows the named playlists and offers that oneconfirm instead of the generic "Could not delete that item. Try again."
PR #163 merged into dev (chief of staff review). One gap, still on this issue: Remove from these playlists and delete removes playlist items but does not push the changed playlists to the screens —
delete_medianever callspush_current_assignment. Screens keep showing the deleted document until the next playlist edit. Fix: afterdelete_removing_playlist_refs, push every playlist named in the conflict to its devices, with a test. @prismancer, this is yours, small; then #156.Done: #163 (named blocking playlists) and #167 (push the changed playlist to its devices after remove-and-delete) are both merged into dev.