Opened 4 months ago

Closed 6 weeks ago

#23317 closed defect (bug) (fixed)

Featured Image able to be set before image processed

Reported by: bobbravo2 Owned by: markjaquith
Priority: normal Milestone: 3.6
Component: Media Version: 3.5.1
Severity: normal Keywords: has-patch needs-testing
Cc: koopersmith, eric@…, kadamwhite, CrazyJaco

Description

Steps to reproduce:

  • Click set featured image
  • Upload new (larger) file
  • Click set featured image before the image has been resized.

The media modal show a blank square upon reopening the dialog: http://cl.ly/image/2h3R30432J2u

In addition, the featured image interface breaks until the page is reloaded. To confirm, after seeing the blank media box as pictured, try setting the featured image again.

Tested on 3.6-alpha-23334 with WP_DEBUG && SCRIPT_DEBUG set to true

Attachments (3)

featured_image_blank_box.PNG (102.8 KB) - added by ew_holmes 4 months ago.
Screenshot of the result.
media-views.diff (663 bytes) - added by kadamwhite 3 months ago.
Patch to prevent submission of media frame if any selected attachment is still uploading
media-views.2.diff (626 bytes) - added by kadamwhite 6 weeks ago.
Flipped operands of === per georgestephanis

Download all attachments as: .zip

Change History (12)

  • Cc koopersmith added
  • Milestone changed from Awaiting Review to 3.5.2
  • Version set to 3.5.1

Is this reproducible in 3.5.0? I am guessing not.

  • Cc eric@… added
  • Keywords needs-patch added

This is reproducible in 3.5.0-RC4. Selecting "Set featured image" before the image is processed/uploaded causes the Featured image modal to close, but the featured image is not set.

Upon re-opening the featured image selection, the original image is there, along with the blank square. It disappears when the page is refreshed.

Screenshot of the result.

  • Cc kadamwhite added
  • Cc CrazyJaco added

If any attachments within the current selection have not finished uploading, then the submit button will fail in both the "Insert Media" frame and the "Set Featured Image" media frame. The extra ghost attachment item is just a side-effect of the weird state you get by trying to set the featured image when the attachment's data isn't available.

After speaking with Helen, we feel it makes sense to disable the submit button if any image within the current selection has not yet finished uploading. This will prevent the unexpected behavior of clicking the "insert" button and seeing no action, as well as preventing the creation of the empty extra Attachment model.

CrazyJaco & I have a patch for this, attached above. We are using _.map to get a list of the uploading state of all models within the collection, then identifying whether any of those uploads are still in progress with _.some.

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

Re-uploaded the patch to remove the call to _.map, as it was completely unneeded -- you can call .get('uploading') from directly within _.some()

Patch to prevent submission of media frame if any selected attachment is still uploading

  • Milestone changed from 3.5.2 to 3.6

Just tested this against latest trunk—it merges cleanly and seems to still do its job.

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

In 23956:

Don't allow images to be set as featured image until they have been processed.

props kadamwhite. fixes #23317.

Flipped operands of === per georgestephanis

Note: See TracTickets for help on using tickets.