[wp-trac] [WordPress Trac] #53171: Total number of attachments not updated when attachment uploaded

WordPress Trac noreply at wordpress.org
Sun Jun 13 20:31:02 UTC 2021


#53171: Total number of attachments not updated when attachment uploaded
-------------------------------------+-------------------------------------
 Reporter:  joedolson                |       Owner:  (none)
     Type:  defect (bug)             |      Status:  assigned
 Priority:  normal                   |   Milestone:  5.8
Component:  Media                    |     Version:  trunk
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  javascript,
  2nd-opinion                        |  administration
-------------------------------------+-------------------------------------
Changes (by joedolson):

 * keywords:  needs-patch => has-patch needs-testing 2nd-opinion


Comment:

 I'm not sure this is the best way to handle this, but it does work. Patch
 adds two private functions attached to the observer on the attachments
 model, one tracking additions and one on removals. It just increments the
 total attachments up or down one based on behavior.

 Tested when adding an attachment, deleting an attachment, bulk deleting
 attachments, and bulk adding items.

 What I'm unsure about is whether incrementing up and down is really going
 to be sufficiently reliable - however, we aren't updating the query
 results on add/remove events, so getting that from the AJAX response
 doesn't seem viable.

 I tested this with 50105.13.diff applied from #50105, but I don't think
 anything in this patch actually depends on that.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53171#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list