Make WordPress Core

Changeset 40084 for branches/4.7


Ignore:
Timestamp:
02/20/2017 06:34:17 AM (8 years ago)
Author:
dd32
Message:

REST API: JavaScript client should use _.extend when merging objects.

Correct an issue during the client's dynamic route discovery in wp.api.utils.decorateFromRoute where _.union potentially failed if used on objects.

Props ketuchetan, adamsilverstein.
Merges [40040] to the 4.7 branch.
Fixes #39341.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-includes/js/wp-api.js

    r39682 r40084  
    186186
    187187                        // We already have args, merge these new args in.
    188                         modelInstance.prototype.args = _.union( routeEndpoint.args, modelInstance.prototype.defaults );
     188                        modelInstance.prototype.args = _.extend( modelInstance.prototype.args, routeEndpoint.args );
    189189                    }
    190190                }
     
    203203
    204204                            // We already have options, merge these new args in.
    205                             modelInstance.prototype.options = _.union( routeEndpoint.args, modelInstance.prototype.options );
     205                            modelInstance.prototype.options = _.extend( modelInstance.prototype.options, routeEndpoint.args );
    206206                        }
    207207                    }
Note: See TracChangeset for help on using the changeset viewer.