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

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

Built from https://develop.svn.wordpress.org/trunk@41248


git-svn-id: http://core.svn.wordpress.org/trunk@41088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-08-13 06:11:43 +00:00
parent e956aa4176
commit 5c755f652b
3 changed files with 9 additions and 5 deletions

View File

@ -708,10 +708,14 @@ wp.mediaWidgets = ( function( $ ) {
control.model.set( control.getModelPropsFromMediaFrame( mediaFrame ) );
});
// Disable syncing of attachment changes back to server. See <https://core.trac.wordpress.org/ticket/40403>.
// Disable syncing of attachment changes back to server (except for deletions). See <https://core.trac.wordpress.org/ticket/40403>.
defaultSync = wp.media.model.Attachment.prototype.sync;
wp.media.model.Attachment.prototype.sync = function rejectedSync() {
return $.Deferred().rejectWith( this ).promise();
wp.media.model.Attachment.prototype.sync = function( method ) {
if ( 'delete' === method ) {
return defaultSync.apply( this, arguments );
} else {
return $.Deferred().rejectWith( this ).promise();
}
};
mediaFrame.on( 'close', function onClose() {
wp.media.model.Attachment.prototype.sync = defaultSync;

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9-alpha-41247';
$wp_version = '4.9-alpha-41248';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.