From 5e39581c138392870acc20b50930620ebd4cb009 Mon Sep 17 00:00:00 2001 From: Daryl Koopersmith Date: Wed, 21 Nov 2012 12:11:38 +0000 Subject: [PATCH] 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: http://core.svn.wordpress.org/trunk@22750 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/js/media-models.js | 2 ++ wp-includes/js/media-views.js | 7 +------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/wp-includes/js/media-models.js b/wp-includes/js/media-models.js index 925da4970c..59851402ac 100644 --- a/wp-includes/js/media-models.js +++ b/wp-includes/js/media-models.js @@ -434,6 +434,8 @@ window.wp = window.wp || {}; // when `observe()` calls `validateAll()`. this.reset( [], { silent: true } ); this.observe( attachments ); + + return this; }, unmirror: function() { diff --git a/wp-includes/js/media-views.js b/wp-includes/js/media-views.js index 3ba90e30ae..3d461dc5c2 100644 --- a/wp-includes/js/media-views.js +++ b/wp-includes/js/media-views.js @@ -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 ); },