Opened 6 months ago

Closed 6 months ago

#22673 closed defect (bug) (fixed)

QuickPress: Media modal doesn't use the new post id when a post is published

Reported by: ocean90 Owned by: ryan
Priority: normal Milestone: 3.5
Component: Media Version: 3.5
Severity: normal Keywords: has-patch needs-testing
Cc:

Description

  • Upload and insert an image to QuickPress
  • Save/publish the post
  • Open the media modal again
  • Go to the library and select "Uploaded to this post"

It should be empty, but still contains the old image. Also new uploads will be attached to the old post.

Do we have a "render new media modal" method which we can fire on a new QuickPress rendering?

Attachments (2)

22673.diff (10.6 KB) - added by nacin 6 months ago.
22673.2.diff (12.0 KB) - added by koopersmith 6 months ago.

Download all attachments as: .zip

Change History (7)

The templates are designed to be post-agnostic on render precisely for situations like this.

So I suppose we need to set media.view.settings.postId on the fly. This value also gets copied over to media.model.

This isn't going to be enough, we're also going to need to change the corresponding update nonce.

Possibly relevant: If you upload an image, abandon the post, and then return to QuickPress later, the same ID and Auto Draft are in play. Then, if you upload an image and save or publish the new draft, it will have two attachments.

nacin6 months ago

  • Keywords has-patch needs-testing added; needs-patch removed

Patches refresh all of the global post-related JS variables when QuickPress publishes a post, then recreates the modal, and makes sure anything involving post IDs is dynamic.

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In 22994:

In the QuickPress media modal, use the new post id when a post is published.

Props nacin, koopersmith
fixes #22673

Note: See TracTickets for help on using tickets.