Make WordPress Core

Changeset 52725 for trunk


Ignore:
Timestamp:
02/14/2022 02:19:10 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Media: Display an error message in grid view if the attachment could not be deleted.

Previously, the attachment was silently removed from the grid but reappeared after a page reload.

Follow-up to [22869].

Props kapilpaul, costdev, mukesh27, azouamauriac, SergeyBiryukov.
Fixes #55158.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/media/views/attachment/details.js

    r50367 r52725  
    155155
    156156        if ( window.confirm( l10n.warnDelete ) ) {
    157             this.model.destroy();
     157            this.model.destroy( {
     158                wait: true,
     159                error: function() {
     160                    window.alert( l10n.errorDeleting );
     161                }
     162            } );
     163
    158164            this.moveFocus();
    159165        }
  • trunk/src/wp-includes/media.php

    r52718 r52725  
    44834483        'restoreSelected'             => __( 'Restore from Trash' ),
    44844484        'deletePermanently'           => __( 'Delete permanently' ),
     4485        'errorDeleting'               => __( 'Error in deleting the attachment.' ),
    44854486        'apply'                       => __( 'Apply' ),
    44864487        'filterByDate'                => __( 'Filter by date' ),
Note: See TracChangeset for help on using the changeset viewer.