Media: Remove redundant code.

Make the composite gallery library use `mirror` instead of `observe`, as one method now invokes the other. Also, make `mirror` return the attachment collection for chaining.

see #21390.


git-svn-id: https://develop.svn.wordpress.org/trunk@22750 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith 2012-11-21 12:11:38 +00:00
parent b69e4bf685
commit aa3bfdc808
2 changed files with 3 additions and 6 deletions

View File

@ -434,6 +434,8 @@ window.wp = window.wp || {};
// when `observe()` calls `validateAll()`.
this.reset( [], { silent: true } );
this.observe( attachments );
return this;
},
unmirror: function() {

View File

@ -403,12 +403,7 @@
return !! original.getByCid( attachment.cid ) && ! exclude.getByCid( attachment.cid );
};
composite.observe( original ).observe( exclude );
// When `more()` is triggered on the composite collection,
// pass the command over to the `original`, which will
// populate the query.
composite.more = _.bind( original.more, original );
composite.mirror( original ).observe( exclude );
this.set( 'library', composite );
},