diff --git a/src/js/media/models/attachments.js b/src/js/media/models/attachments.js index 7698034134..a0ba72869b 100644 --- a/src/js/media/models/attachments.js +++ b/src/js/media/models/attachments.js @@ -350,14 +350,14 @@ var Attachments = Backbone.Collection.extend(/** @lends wp.media.model.Attachmen /** * Holds the total number of attachments. * - * @since 5.7.0 + * @since 5.8.0 */ totalAttachments: 0, /** * Gets the total number of attachments. * - * @since 5.7.0 + * @since 5.8.0 * * @return {number} The total number of attachments. */ @@ -368,15 +368,15 @@ var Attachments = Backbone.Collection.extend(/** @lends wp.media.model.Attachmen /** * A custom Ajax-response parser. * - * See trac ticket #24753 + * See trac ticket #24753. * * Called automatically by Backbone whenever a collection's models are returned * by the server, in fetch. The default implementation is a no-op, simply * passing through the JSON response. We override this to add attributes to * the collection items. * - * Since WordPress 5.5, the response returns the attachments under `response.attachments` - * and `response.totalAttachments` holds the total number of attachments found. + * @since 5.8.0 The response returns the attachments under `response.attachments` and + * `response.totalAttachments` holds the total number of attachments found. * * @param {Object|Array} response The raw response Object/Array. * @param {Object} xhr @@ -384,7 +384,7 @@ var Attachments = Backbone.Collection.extend(/** @lends wp.media.model.Attachmen */ parse: function( response, xhr ) { if ( ! _.isArray( response.attachments ) ) { - response = [response.attachments]; + response = [ response.attachments ]; } this.totalAttachments = parseInt( response.totalAttachments, 10 ); diff --git a/src/js/media/models/query.js b/src/js/media/models/query.js index 471d828ac6..d744537c44 100644 --- a/src/js/media/models/query.js +++ b/src/js/media/models/query.js @@ -113,7 +113,6 @@ Query = Attachments.extend(/** @lends wp.media.model.Query.prototype */{ options.remove = false; return this._more = this.fetch( options ).done( function( response ) { - // Since WordPress 5.5, the response returns the attachments under `response.attachments`. var attachments = response.attachments; if ( _.isEmpty( attachments ) || -1 === this.args.posts_per_page || attachments.length < this.args.posts_per_page ) { diff --git a/src/js/media/views/attachments.js b/src/js/media/views/attachments.js index 1fc9d777d6..b2e91624cb 100644 --- a/src/js/media/views/attachments.js +++ b/src/js/media/views/attachments.js @@ -36,6 +36,8 @@ Attachments = View.extend(/** @lends wp.media.view.Attachments.prototype */{ this.el.id = _.uniqueId('__attachments-view-'); /** + * @since 5.8.0 Added the `infiniteScrolling` parameter. + * * @param infiniteScrolling Whether to enable infinite scrolling or use * the default "load more" button. * @param refreshSensitivity The time in milliseconds to throttle the scroll diff --git a/src/js/media/views/attachments/browser.js b/src/js/media/views/attachments/browser.js index ccf26c710a..6a75fb9a7d 100644 --- a/src/js/media/views/attachments/browser.js +++ b/src/js/media/views/attachments/browser.js @@ -456,7 +456,7 @@ AttachmentsBrowser = View.extend(/** @lends wp.media.view.AttachmentsBrowser.pro /** * Creates the Attachments wrapper view. * - * @since 5.7.0 + * @since 5.8.0 * * @return {void} */ @@ -506,7 +506,7 @@ AttachmentsBrowser = View.extend(/** @lends wp.media.view.AttachmentsBrowser.pro /** * Creates the load more button and attachments counter view. * - * @since 5.7.0 + * @since 5.8.0 * * @return {void} */ @@ -557,7 +557,7 @@ AttachmentsBrowser = View.extend(/** @lends wp.media.view.AttachmentsBrowser.pro * collection updates multiple times at the add, remove, and reset events. * We need it to run only once, after all attachments are added or removed. * - * @since 5.7.0 + * @since 5.8.0 * * @return {void} */ @@ -610,7 +610,7 @@ AttachmentsBrowser = View.extend(/** @lends wp.media.view.AttachmentsBrowser.pro /** * Loads more attachments. * - * @since 5.7.0 + * @since 5.8.0 * * @return {void} */ @@ -645,7 +645,7 @@ AttachmentsBrowser = View.extend(/** @lends wp.media.view.AttachmentsBrowser.pro /** * Moves focus to the first new added item. . * - * @since 5.7.0 + * @since 5.8.0 * * @return {void} */ diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 968a5a3985..275cc4cea6 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -2927,6 +2927,8 @@ function wp_ajax_get_attachment() { * Ajax handler for querying attachments. * * @since 3.5.0 + * @since 5.8.0 The response returns the attachments under `response.attachments` and + * `response.totalAttachments` holds the total number of attachments found. */ function wp_ajax_query_attachments() { if ( ! current_user_can( 'upload_files' ) ) { diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index b3dfeb0c6f..19fa2b8b9d 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -4309,7 +4309,7 @@ function wp_enqueue_media( $args = array() ) { /** * Filters whether the Media Library grid has infinite scrolling. Default `false`. * - * @since 5.7.0 + * @since 5.8.0 * * @param bool $value The filtered value, defaults to `false`. */