Repository navigation
Media: Skip the bulk delete confirmation when no items are selected. - #16517
ankit-addweb wants to merge 1 commit into
Conversation
The list table bulk action handler showed the "permanently delete these items" warning for the Delete permanently action even when no media items were checked. Only confirm when at least one item is selected.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Trac ticket: https://core.trac.wordpress.org/ticket/66944
Problem
On the Media Library list view (
upload.php), choosing the "Delete permanently" bulk action and clicking Apply shows the "You are about to permanently delete these items from your site" confirmation even when no media items are selected.Cause
The
#doactionclick handler insrc/js/_enqueues/admin/media.jscallsshowNotice.warn()for thedeleteaction without checking whether any rows are checked.Fix
Return early when no
input[name="media[]"]is checked, so there is nothing to confirm. When items are selected, the confirmation still appears and Cancel still stops the submission.Testing
Tested in a local Docker environment on trunk (7d7791a).