From a84cef455665e2b52b4d4deb21d26cf4d2722712 Mon Sep 17 00:00:00 2001 From: Daryl Koopersmith Date: Fri, 4 Jan 2013 08:28:12 +0000 Subject: [PATCH] Media: Properly reset the "add to gallery" library to ensure it accurately reflects the current gallery. see #22815. git-svn-id: http://core.svn.wordpress.org/trunk@23263 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/js/media-views.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wp-includes/js/media-views.js b/wp-includes/js/media-views.js index 1050420044..a045499995 100644 --- a/wp-includes/js/media-views.js +++ b/wp-includes/js/media-views.js @@ -661,6 +661,10 @@ return !! this.mirroring.getByCid( attachment.cid ) && ! edit.getByCid( attachment.cid ) && media.model.Selection.prototype.validator.apply( this, arguments ); }; + // Reset the library to ensure that all attachments are re-added + // to the collection. Do so silently, as calling `observe` will + // trigger the `reset` event. + library.reset( library.mirroring.models, { silent: true }); library.observe( edit ); this.editLibrary = edit;