WordPress.org

Make WordPress Core

Ticket #41549: 41549.diff

File 41549.diff, 2.1 KB (added by adamsilverstein, 2 years ago)
  • src/wp-includes/js/wp-api.js

    diff --git src/wp-includes/js/wp-api.js src/wp-includes/js/wp-api.js
    index 856aa4c8b5..8d4123c176 100644
     
    809809                         * @returns {*}.
    810810                         */
    811811                        sync: function( method, model, options ) {
    812                                 var beforeSend;
     812                                var beforeSend, toReturn, storedAjax;
    813813
    814814                                options = options || {};
    815815
     
    852852                                if ( this.requireForceForDelete && 'delete' === method ) {
    853853                                        model.url = model.url() + '?force=true';
    854854                                }
    855                                 return Backbone.sync( method, model, options );
     855                                storedAjax = Backbone.ajax;
     856                                Backbone.ajax = wp.apiRequest.transport;
     857                                toReturn = Backbone.sync( method, model, options );
     858                                Backbone.ajax = storedAjax;
     859                                return toReturn;
    856860                        },
    857861
    858862                        /**
  • tests/qunit/fixtures/wp-api.js

    diff --git tests/qunit/fixtures/wp-api.js tests/qunit/fixtures/wp-api.js
    index 04c9dd1823..5dc8062c85 100644
    var pathToData = { 
    3636 *
    3737 * @return {Object}       A jQuery deferred object that resolves with the mapped data.
    3838 */
    39 Backbone.ajax = function ( param ) {
     39wp.apiRequest.transport = Backbone.ajax = function ( param ) {
    4040
    4141        var data,
    4242                request = param.url
  • tests/qunit/index.html

    diff --git tests/qunit/index.html tests/qunit/index.html
    index 5ed4c7a02d..46037d2e2b 100644
     
    6262        </head>
    6363        <body>
    6464                <div id="qunit"></div>
     65                <!-- Load api-request early for test overwriting -->
     66                <script src="../../src/wp-includes/js/api-request.js"></script>
    6567                <div id="qunit-fixture">
    6668                        <script src="fixtures/customize-header.js"></script>
    6769                        <script src="fixtures/customize-settings.js"></script>
     
    7981                <script src="../../src/wp-includes/js/shortcode.js"></script>
    8082                <script src="../../src/wp-includes/js/wp-hooks.js"></script>
    8183                <script src="../../src/wp-admin/js/customize-controls.js"></script>
    82                 <script src="../../src/wp-includes/js/api-request.js"></script>
    8384                <script src="../../src/wp-includes/js/wp-api.js"></script>
    8485
    8586                <script type='text/javascript' src='../../src/wp-includes/js/jquery/ui/core.js'></script>