WordPress.org

Make WordPress Core

Changeset 41248


Ignore:
Timestamp:
08/13/17 06:10:11 (3 months ago)
Author:
westonruter
Message:

Customize: Prevent attachment deletions from silently failing in media modals opened for Media widgets.

Amends [40640].
See #32417.
Fixes #41609.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/widgets/media-widgets.js

    r41206 r41248  
    709709            }); 
    710710 
    711             // Disable syncing of attachment changes back to server. See <https://core.trac.wordpress.org/ticket/40403>. 
     711            // Disable syncing of attachment changes back to server (except for deletions). See <https://core.trac.wordpress.org/ticket/40403>. 
    712712            defaultSync = wp.media.model.Attachment.prototype.sync; 
    713             wp.media.model.Attachment.prototype.sync = function rejectedSync() { 
    714                 return $.Deferred().rejectWith( this ).promise(); 
     713            wp.media.model.Attachment.prototype.sync = function( method ) { 
     714                if ( 'delete' === method ) { 
     715                    return defaultSync.apply( this, arguments ); 
     716                } else { 
     717                    return $.Deferred().rejectWith( this ).promise(); 
     718                } 
    715719            }; 
    716720            mediaFrame.on( 'close', function onClose() { 
Note: See TracChangeset for help on using the changeset viewer.