Make WordPress Core

Ticket #42658: 42658.2.diff

File 42658.2.diff, 2.0 KB (added by dlh, 7 years ago)
  • src/wp-admin/js/customize-controls.js

    diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
    index 5afcd783bd..785fc7f895 100644
     
    82088208                        // Check for lock when sending heartbeat requests.
    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
    82138214                        // Handle heartbeat ticks.
  • src/wp-includes/class-wp-customize-manager.php

    diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
    index bc215fef56..2cddb70370 100644
    final class WP_Customize_Manager { 
    32043204         * @return array The Heartbeat response.
    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 ) {
    32113222                                $response['customize_changeset_lock_user'] = $this->get_lock_user_data( $lock_user_id );
    32123223                        } else {
    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                }
    32183229