Plugins and Themes Auto-Updates: update the state of the auto-update link on the themes screen after successfully saving the setting.

Props desrosj, pbiron, azaozz.
Fixes #50291.
Built from https://develop.svn.wordpress.org/trunk@47883


git-svn-id: http://core.svn.wordpress.org/trunk@47657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2020-06-01 20:53:15 +00:00
parent 94be20e612
commit 0318a92948
5 changed files with 24 additions and 4 deletions

View File

@ -666,7 +666,8 @@ themes.view.Details = wp.Backbone.View.extend({
'click .delete-theme': 'deleteTheme',
'click .left': 'previousTheme',
'click .right': 'nextTheme',
'click #update-theme': 'updateTheme'
'click #update-theme': 'updateTheme',
'click .toggle-auto-update': 'autoupdateState'
},
// The HTML template for the theme overlay.
@ -787,6 +788,23 @@ themes.view.Details = wp.Backbone.View.extend({
this.trigger( 'theme:collapse' );
},
// Set state of the auto-update settings link after it has been changed and saved.
autoupdateState: function() {
var callback,
_this = this;
// Support concurrent clicks in different Theme Details overlays.
callback = function( event, data ) {
if ( _this.model.get( 'id' ) === data.asset ) {
_this.model.set( { autoupdate: 'enable' === data.state } );
$( document ).off( 'wp-auto-update-setting-changed', callback );
}
}
// Triggered in updates.js
$( document ).on( 'wp-auto-update-setting-changed', callback );
},
updateTheme: function( event ) {
var _this = this;
event.preventDefault();

File diff suppressed because one or more lines are too long

View File

@ -2599,6 +2599,8 @@
$parent.find( '.auto-update-time' ).addClass( 'hidden' );
wp.a11y.speak( wp.updates.l10n.autoUpdatesDisabled, 'polite' );
}
$document.trigger( 'wp-auto-update-setting-changed', { state: action, type: type, asset: asset } );
} )
.fail( function() {
$parent.find( '.notice.error' ).removeClass( 'hidden' ).find( 'p' ).text( wp.updates.l10n.autoUpdatesError );

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-alpha-47882';
$wp_version = '5.5-alpha-47883';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.