Make WordPress Core

Ticket #41055: 41055.diff

File 41055.diff, 1.1 KB (added by adamsilverstein, 9 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 3f950a47f5..cadddf5ee4 100644
     
    466466                         * Add a helper function to handle post Meta.
    467467                         */
    468468                        MetaMixin = {
     469
     470                                /**
     471                                 * Get the meta for a post.
     472                                 *
     473                                 * @return {object} The post meta, as a key value pair object.
     474                                 */
    469475                                getMeta: function() {
    470                                         return buildCollectionGetter( this, 'PostMeta', 'https://api.w.org/meta' );
    471                                 }
     476                                        return this.get( 'meta' );
     477                                },
     478
     479                                /**
     480                                 * Set the meta for a post.
     481                                 *
     482                                 * @param {object}
     483                                 */
     484
     485                                setMeta: function( meta ) {
     486                                        this.set( 'meta', meta );
     487                                },
     488
     489
    472490                        },
    473491
    474492                        /**
     
    699717                        model = model.extend( CategoriesMixin );
    700718                }
    701719
    702                 // Add the MetaMixin for models that support meta collections.
    703                 if ( ! _.isUndefined( loadingObjects.collections[ modelClassName + 'Meta' ] ) ) {
     720                // Add the MetaMixin for models that support meta.
     721                if ( ! _.isUndefined( model.prototype.args.meta ) ) {
    704722                        model = model.extend( MetaMixin );
    705723                }
    706724