Make WordPress Core

Changeset 42612


Ignore:
Timestamp:
01/29/2018 11:04:22 PM (6 years ago)
Author:
westonruter
Message:

Customize: Ensure heartbeat keeps changeset locked when in branching mode.

Props dlh.
See #42024.
Fixes #42658.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/customize-controls.js

    r42543 r42612  
    82098209            $( document ).on( 'heartbeat-send.update_lock_notice', function( event, data ) {
    82108210                data.check_changeset_lock = true;
     8211                data.changeset_uuid = api.settings.changeset.uuid;
    82118212            } );
    82128213
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r42541 r42612  
    32053205     */
    32063206    public function check_changeset_lock_with_heartbeat( $response, $data, $screen_id ) {
    3207         if ( array_key_exists( 'check_changeset_lock', $data ) && 'customize' === $screen_id && current_user_can( 'customize' ) && $this->changeset_post_id() ) {
    3208             $lock_user_id = wp_check_post_lock( $this->changeset_post_id() );
     3207        if ( isset( $data['changeset_uuid'] ) ) {
     3208            $changeset_post_id = $this->find_changeset_post_id( $data['changeset_uuid'] );
     3209        } else {
     3210            $changeset_post_id = $this->changeset_post_id();
     3211        }
     3212
     3213        if (
     3214            array_key_exists( 'check_changeset_lock', $data )
     3215            && 'customize' === $screen_id
     3216            && $changeset_post_id
     3217            && current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post_id )
     3218        ) {
     3219            $lock_user_id = wp_check_post_lock( $changeset_post_id );
    32093220
    32103221            if ( $lock_user_id ) {
     
    32133224
    32143225                // Refreshing time will ensure that the user is sitting on customizer and has not closed the customizer tab.
    3215                 $this->refresh_changeset_lock( $this->changeset_post_id() );
     3226                $this->refresh_changeset_lock( $changeset_post_id );
    32163227            }
    32173228        }
Note: See TracChangeset for help on using the changeset viewer.