Trash bin polish: URL badge, live placement badge, no media auto-trash#214
Merged
Conversation
Three Trash-bin improvements driven by PR #206 feedback: - URL placements (file_type='link') now carry a 'URL' type_label, so the inline badge reads "URL" instead of the generic "Placement". Other placement kinds keep the existing humanized bucket label. - Trash icon badge updates live when a URL/shortcut/folder is moved to Trash. The desktop-files trash helper was emitting { reason: 'trash' } which the badge subscriber couldn't decode; it now follows the cross-window convention { source, action, ids } matching how posts/pages/attachments already broadcast. The badge also subscribes to the placement / shortcut / folder channels. - Removes the `pre_delete_attachment` interception so media files follow vanilla WordPress behavior — permanent-delete on first click, no auto-routing through Trash. This resolves the "plugin .zips show up as Media in Trash bin" feedback at the source: nothing auto-trashes them anymore. Sites that want media-in-trash can opt in by setting `MEDIA_TRASH=true` in `wp-config.php`; the Recycle Bin still tracks `attachment` in its default capture_post_types list, so trashed media surfaces automatically when something else (REST, programmatic trash, MEDIA_TRASH-enabled delete flow) routes it there. Coverage: 4 PHPUnit cases for the URL label, the no-auto-trash default, and the unaffected post-trash flow. 3 vitest cases verifying the placement / shortcut / folder broadcast shape.
Contributor
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #206. Three small Trash-bin improvements from post-merge feedback.
Summary
URLin the inline type badge instead of the genericPlacement. Other placement kinds keep their existing humanized bucket label.{ reason: 'trash' }, which the badge subscriber couldn't decode — so the dock badge stayed stale until the next Heartbeat tick (15–60s). Now it emits the cross-window convention{ source, action, ids }that posts/pages/attachments already use, and the badge subscribes to theplacement.changed/shortcut.changed/folder.changedchannels.pre_delete_attachment, so Media-library delete actually permanent-deletes on first click. This resolves the "plugin .zip shows up in Trash bin as Media" feedback at the source — nothing auto-trashes those files anymore. Sites that want media-in-trash can opt in by settingdefine( 'MEDIA_TRASH', true );inwp-config.php; the Recycle Bin still tracksattachmentin its default capture list, so trashed media surfaces automatically when any path (REST, programmaticwp_trash_post, MEDIA_TRASH-enabled flow) routes it there.Test plan
URLbadge instead ofPLACEMENT.Coverage