Ticket #39314: 39314.2.diff
File 39314.2.diff, 1.6 KB (added by , 8 years ago) |
---|
-
src/wp-includes/js/wp-api.js
321 321 // Create the new getModel model. 322 322 getModel = new wp.api.models[ modelName ]( attributes ); 323 323 324 // If we didn’t have an embedded getModel, fetch the getModel data.325 324 if ( ! getModel.get( embedCheckField ) ) { 326 getModel.fetch( { success: function( getModel ) { 327 deferred.resolve( getModel ); 328 } } ); 325 getModel.fetch( { 326 success: function( getModel ) { 327 deferred.resolve( getModel ); 328 }, 329 error: function( getModel, response ) { 330 deferred.reject( response ); 331 } 332 } ); 329 333 } else { 334 // Resolve with the embedded model. 330 335 deferred.resolve( getModel ); 331 336 } 332 337 … … 392 397 393 398 // If we didn’t have embedded getObjects, fetch the getObjects data. 394 399 if ( _.isUndefined( getObjects.models[0] ) ) { 395 getObjects.fetch( { success: function( getObjects ) { 400 getObjects.fetch( { 401 success: function( getObjects ) { 396 402 397 // Add a helper 'parent_post' attribute onto the model. 398 setHelperParentPost( getObjects, postId ); 399 deferred.resolve( getObjects ); 400 } } ); 403 // Add a helper 'parent_post' attribute onto the model. 404 setHelperParentPost( getObjects, postId ); 405 deferred.resolve( getObjects ); 406 }, 407 error: function( getModel, response ) { 408 deferred.reject( response ); 409 } 410 } ); 401 411 } else { 402 412 403 413 // Add a helper 'parent_post' attribute onto the model.