Customize: Let default status for Customizer be `draft` if user does not have capability to `publish`.

Amends [41626].
Props sayedwp, westonruter.
See #30937.
Fixes #42686.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2018-01-22 19:10:34 +00:00
parent 183cda343a
commit 94d178dd31
3 changed files with 8 additions and 8 deletions

View File

@ -7904,7 +7904,7 @@
previewerAlive = state.instance( 'previewerAlive' ), previewerAlive = state.instance( 'previewerAlive' ),
editShortcutVisibility = state.instance( 'editShortcutVisibility' ), editShortcutVisibility = state.instance( 'editShortcutVisibility' ),
changesetLocked = state.instance( 'changesetLocked' ), changesetLocked = state.instance( 'changesetLocked' ),
populateChangesetUuidParam; populateChangesetUuidParam, defaultSelectedChangesetStatus;
state.bind( 'change', function() { state.bind( 'change', function() {
var canSave; var canSave;
@ -7938,9 +7938,7 @@
} else { } else {
saveBtn.val( api.l10n.schedule ); saveBtn.val( api.l10n.schedule );
} }
} else if ( ! api.settings.changeset.currentUserCanPublish ) { } else if ( api.settings.changeset.currentUserCanPublish ) {
selectedChangesetStatus( 'draft' );
} else {
saveBtn.val( api.l10n.publish ); saveBtn.val( api.l10n.publish );
} }
closeBtn.find( '.screen-reader-text' ).text( api.l10n.cancel ); closeBtn.find( '.screen-reader-text' ).text( api.l10n.cancel );
@ -7962,12 +7960,14 @@
return status; return status;
}; };
defaultSelectedChangesetStatus = api.settings.changeset.currentUserCanPublish ? 'publish' : 'draft';
// Set default states. // Set default states.
changesetStatus( api.settings.changeset.status ); changesetStatus( api.settings.changeset.status );
changesetLocked( Boolean( api.settings.changeset.lockUser ) ); changesetLocked( Boolean( api.settings.changeset.lockUser ) );
changesetDate( api.settings.changeset.publishDate ); changesetDate( api.settings.changeset.publishDate );
selectedChangesetDate( api.settings.changeset.publishDate ); selectedChangesetDate( api.settings.changeset.publishDate );
selectedChangesetStatus( '' === api.settings.changeset.status || 'auto-draft' === api.settings.changeset.status ? 'publish' : api.settings.changeset.status ); selectedChangesetStatus( '' === api.settings.changeset.status || 'auto-draft' === api.settings.changeset.status ? defaultSelectedChangesetStatus : api.settings.changeset.status );
selectedChangesetStatus.link( changesetStatus ); // Ensure that direct updates to status on server via wp.customizer.previewer.save() will update selection. selectedChangesetStatus.link( changesetStatus ); // Ensure that direct updates to status on server via wp.customizer.previewer.save() will update selection.
saved( true ); saved( true );
if ( '' === changesetStatus() ) { // Handle case for loading starter content. if ( '' === changesetStatus() ) { // Handle case for loading starter content.

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.0-alpha-42541'; $wp_version = '5.0-alpha-42543';
/** /**
* 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.