WordPress.org

Make WordPress Core

Changeset 38772


Ignore:
Timestamp:
10/10/2016 10:41:26 PM (21 months ago)
Author:
azaozz
Message:

Editor: do not send the request for releasing the post lock on unload when post_ID or active_post_lock is missing.

Props dlh, adamsilverstein.
Fixes #38271.

File:
1 edited

Legend:

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

    r38637 r38772  
    106106     *
    107107     * @param {string} html New HTML to be displayed in the content area of the postbox.
    108      * 
     108     *
    109109     * @global
    110110     */
     
    500500        }
    501501
     502        var postID = $('#post_ID').val();
     503        var postLock = $('#active_post_lock').val();
     504
     505        if ( ! postID || ! postLock ) {
     506            return;
     507        }
     508
    502509        var data = {
    503510            action: 'wp-remove-post-lock',
    504511            _wpnonce: $('#_wpnonce').val(),
    505             post_ID: $('#post_ID').val(),
    506             active_post_lock: $('#active_post_lock').val()
     512            post_ID: postID,
     513            active_post_lock: postLock
    507514        };
    508515
    509         if (window.FormData && window.navigator.sendBeacon) {
     516        if ( window.FormData && window.navigator.sendBeacon ) {
    510517            var formData = new window.FormData();
    511518
    512             $.each(data, function(key, value) {
    513                 formData.append(key, value);
     519            $.each( data, function( key, value ) {
     520                formData.append( key, value );
    514521            });
    515522
    516             if (window.navigator.sendBeacon(ajaxurl, formData)) {
     523            if ( window.navigator.sendBeacon( ajaxurl, formData ) ) {
    517524                return;
    518525            }
Note: See TracChangeset for help on using the changeset viewer.