WordPress.org

Make WordPress Core

Changeset 42544


Ignore:
Timestamp:
01/22/2018 07:11:17 PM (22 months ago)
Author:
westonruter
Message:

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 for 4.9 branch.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-admin/js/customize-controls.js

    r42537 r42544  
    79327932                editShortcutVisibility  = state.instance( 'editShortcutVisibility' ),
    79337933                changesetLocked = state.instance( 'changesetLocked' ),
    7934                 populateChangesetUuidParam;
     7934                populateChangesetUuidParam, defaultSelectedChangesetStatus;
    79357935
    79367936            state.bind( 'change', function() {
     
    79667966                            saveBtn.val( api.l10n.schedule );
    79677967                        }
    7968                     } else if ( ! api.settings.changeset.currentUserCanPublish ) {
    7969                         selectedChangesetStatus( 'draft' );
    7970                     } else {
     7968                    } else if ( api.settings.changeset.currentUserCanPublish ) {
    79717969                        saveBtn.val( api.l10n.publish );
    79727970                    }
     
    79907988            };
    79917989
     7990            defaultSelectedChangesetStatus = api.settings.changeset.currentUserCanPublish ? 'publish' : 'draft';
     7991
    79927992            // Set default states.
    79937993            changesetStatus( api.settings.changeset.status );
     
    79957995            changesetDate( api.settings.changeset.publishDate );
    79967996            selectedChangesetDate( api.settings.changeset.publishDate );
    7997             selectedChangesetStatus( '' === api.settings.changeset.status || 'auto-draft' === api.settings.changeset.status ? 'publish' : api.settings.changeset.status );
     7997            selectedChangesetStatus( '' === api.settings.changeset.status || 'auto-draft' === api.settings.changeset.status ? defaultSelectedChangesetStatus : api.settings.changeset.status );
    79987998            selectedChangesetStatus.link( changesetStatus ); // Ensure that direct updates to status on server via wp.customizer.previewer.save() will update selection.
    79997999            saved( true );
Note: See TracChangeset for help on using the changeset viewer.