Customize: Prevent showing SFTP theme installation notification in multisite when user cannot install themes.

Props flixos90.
See #37661, #42184.
Fixes #42674.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2018-01-22 06:15:30 +00:00
parent fa460ab32f
commit cd9f48b54f
4 changed files with 11 additions and 10 deletions

View File

@ -2567,7 +2567,7 @@
// Temporary special function since supplying SFTP credentials does not work yet. See #42184. // Temporary special function since supplying SFTP credentials does not work yet. See #42184.
function disableInstallButtons() { function disableInstallButtons() {
return disableSwitchButtons() || true === api.settings.theme._filesystemCredentialsNeeded; return disableSwitchButtons() || false === api.settings.theme._canInstall || true === api.settings.theme._filesystemCredentialsNeeded;
} }
section.overlay.find( 'button.preview, button.preview-theme' ).toggleClass( 'disabled', disableSwitchButtons() ); section.overlay.find( 'button.preview, button.preview-theme' ).toggleClass( 'disabled', disableSwitchButtons() );
@ -3064,7 +3064,7 @@
api.Panel.prototype.attachEvents.apply( panel ); api.Panel.prototype.attachEvents.apply( panel );
// Temporary since supplying SFTP credentials does not work yet. See #42184 // Temporary since supplying SFTP credentials does not work yet. See #42184
if ( api.settings.theme._filesystemCredentialsNeeded ) { if ( api.settings.theme._canInstall && api.settings.theme._filesystemCredentialsNeeded ) {
panel.notifications.add( new api.Notification( 'theme_install_unavailable', { panel.notifications.add( new api.Notification( 'theme_install_unavailable', {
message: api.l10n.themeInstallUnavailable, message: api.l10n.themeInstallUnavailable,
type: 'info', type: 'info',
@ -5092,7 +5092,7 @@
// Temporary special function since supplying SFTP credentials does not work yet. See #42184. // Temporary special function since supplying SFTP credentials does not work yet. See #42184.
function disableInstallButtons() { function disableInstallButtons() {
return disableSwitchButtons() || true === api.settings.theme._filesystemCredentialsNeeded; return disableSwitchButtons() || false === api.settings.theme._canInstall || true === api.settings.theme._filesystemCredentialsNeeded;
} }
function updateButtons() { function updateButtons() {
control.container.find( 'button.preview, button.preview-theme' ).toggleClass( 'disabled', disableSwitchButtons() ); control.container.find( 'button.preview, button.preview-theme' ).toggleClass( 'disabled', disableSwitchButtons() );

File diff suppressed because one or more lines are too long

View File

@ -4704,6 +4704,7 @@ final class WP_Customize_Manager {
'theme' => array( 'theme' => array(
'stylesheet' => $this->get_stylesheet(), 'stylesheet' => $this->get_stylesheet(),
'active' => $this->is_theme_active(), 'active' => $this->is_theme_active(),
'_canInstall' => current_user_can( 'install_themes' ),
), ),
'url' => array( 'url' => array(
'preview' => esc_url_raw( $this->get_preview_url() ), 'preview' => esc_url_raw( $this->get_preview_url() ),

View File

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