Opened 4 years ago

Closed 3 years ago

#11145 closed defect (bug) (fixed)

No gallery tab after upload if post hasn't been saved yet

Reported by: yoavf Owned by:
Priority: normal Milestone: 3.0
Component: Gallery Version: 2.8
Severity: major Keywords: needs-patch featured
Cc: jeffstieler

Description

Uploading a few pictures to an unsaved post fails to load a proper gallery tab:

Steps to reproduce:

  • Create a new post
  • Do not save, do not enter a title
  • Upload a few images
  • Click save changes

You'll get a non functioning gallery tab, like this one:
http://skitch.com/yoavf/n8127/add-new-post-on-off-wordpress

Change History (15)

Possibly related: #9471

I can confirm this being an issue as well in WPMU version 2.8.6

  • Milestone changed from Unassigned to 3.0

comment:4 follow-up: ↓ 5   jeffstieler3 years ago

  • Cc jeffstieler added

What is the correct course of action to fix this?

I see a few ways of dealing with this:

  1. Autosave just a post ID upon entering the media uploader so there is a valid parent post.
  1. Show a warning to the user upon entering media uploader when there is no post ID, that the media they upload at that point will not have an associated post, and patch get_media_items() to deal with invalid post IDs.
  1. Disallow uploading media to a post without an autosave.

comment:5 in reply to: ↑ 4   Denis-de-Bernardy3 years ago

Replying to jeffstieler:

What is the correct course of action to fix this?

see also #9471

Imo, the correct approach is to immediately assign a uuid to drafts. and since we're now requiring mysql 4.1, we can.

the upload button should then pass the uuid instead of the post_id. and if anything is uploaded we create the post on the fly is no post exists with the same uuid.

This has to be confirmed again because I think this ticket is a duplicate of #9471 (#10456).

  • Keywords needs-patch added

Reproduced. Buggy behaviour confirmed.

Better hope this time a fix is propper.

After doing the test and then looking into #11524 I realized that these images do not even appear in the Media Library, not even unattached. This is getting really esoteric. Others who are willing to reproduce should test if the images do actually exist afterwards in the media library.

Tested 2.9.1-RC1.

In a blank post, the image uploader appears normally. I added 5 photos, clicked Save All Changes in the uploader, which then failed to close and looked a lot like OP's screenshot. I then clicked on Save Draft and was sent straight to the Edit Posts screen. Nothing was saved for the post. The 5 images do appear in the Media Library, unattached.

  • Milestone changed from 3.0 to 2.9.1
  • Severity changed from normal to major
  • Version changed from 2.9 to 2.8

Denis mentioned this was not a 2.9 regression, and I was able to reproduce the same bug in 2.8.4.

#10642 (Cant insert image galleries into new posts (same on wordpress.com)) was closed as duplicate of this

  • Keywords bug-hunt added
  • Keywords featured added; bug-hunt removed
  • Resolution set to fixed
  • Status changed from new to closed

(In [12987]) Create post_status=auto-draft when creating a new post item. status changes to draft on first auto-save. now we always have a real post ID to work with. see #11889. fixes #11145. fixes #11990

Note: See TracTickets for help on using tickets.