Ticket #39314: 39314.diff
File 39314.diff, 1.7 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 335 // Resolve with the embedded model. 330 336 deferred.resolve( getModel ); 331 337 } 332 338 339 333 340 // Return a promise. 334 341 return deferred.promise(); 335 342 }, … … 392 399 393 400 // If we didn’t have embedded getObjects, fetch the getObjects data. 394 401 if ( _.isUndefined( getObjects.models[0] ) ) { 395 getObjects.fetch( { success: function( getObjects ) { 402 getObjects.fetch( { 403 success: function( getObjects ) { 396 404 397 // Add a helper 'parent_post' attribute onto the model. 398 setHelperParentPost( getObjects, postId ); 399 deferred.resolve( getObjects ); 400 } } ); 405 // Add a helper 'parent_post' attribute onto the model. 406 setHelperParentPost( getObjects, postId ); 407 deferred.resolve( getObjects ); 408 }, 409 error: function( getModel, response ) { 410 deferred.reject( response ); 411 } 412 } ); 401 413 } else { 402 414 403 415 // Add a helper 'parent_post' attribute onto the model.