[wp-trac] [WordPress Trac] #53419: Media: Links to individual media items don't work
WordPress Trac
noreply at wordpress.org
Wed Jun 16 20:54:14 UTC 2021
#53419: Media: Links to individual media items don't work
--------------------------+-------------------------
Reporter: ryelle | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.8
Component: Media | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses: javascript
--------------------------+-------------------------
Comment (by adamsilverstein):
Hey @ryelle :} thanks for catching and raising this issue, and especially
for identifying the offending commit!
This is caused by our changing the deferred resolution to use the
(typical) `deferred.jqXHR` instead of core's setting of `this` which
causes us to not have access to the response headers in the collection's
`parse` method (in attachments.js).
This tricky part is we need access to ''both the collection and the
request jqxhr'' to pull the collection totals from the header response and
set them in the collection.
In [attachment:"53419.diff"] I moved the logic out of the custom fetch
method we added into wp.ajax.send where we have access to both the
collection and the actual xhr response. The only addition to the existing
code is a check to make sure this is a media request and capturing the
context (the attachments collection) before the done handler so we can set
the attachment count.
Can you please give it a test and confirm this corrects the issue you were
seeing? It does in my testing.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53419#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list