Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/js/media/models/attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,26 +239,32 @@ var Attachments = Backbone.Collection.extend(/** @lends wp.media.model.Attachmen
return this;
},
/**
* Update total attachment count when items are added to a collection.
* Update total attachment count when items are removed from the mirrored collection.
*
* @access private
*
* @since 5.8.0
*
* @param {wp.media.model.Attachment} attachment The attachment model.
* @param {wp.media.model.Attachments} collection The collection that triggered the event.
*/
_removeFromTotalAttachments: function() {
if ( this.mirroring ) {
_removeFromTotalAttachments: function( attachment, collection ) {
if ( this.mirroring && collection === this.mirroring ) {
this.mirroring.totalAttachments = this.mirroring.totalAttachments - 1;
}
},
/**
* Update total attachment count when items are added to a collection.
* Update total attachment count when items are added to the mirrored collection.
*
* @access private
*
* @since 5.8.0
*
* @param {wp.media.model.Attachment} attachment The attachment model.
* @param {wp.media.model.Attachments} collection The collection that triggered the event.
*/
_addToTotalAttachments: function() {
if ( this.mirroring ) {
_addToTotalAttachments: function( attachment, collection ) {
if ( this.mirroring && collection === this.mirroring ) {
this.mirroring.totalAttachments = this.mirroring.totalAttachments + 1;
}
},
Expand Down
Loading