Make WordPress Core

Opened 13 years ago

Closed 11 years ago

Last modified 11 years ago

#16891 closed defect (bug) (invalid)

Deleting all attachments from post under 'Gallery' tab shows 'From Computer' tab sans uploader

Reported by: kawauso's profile kawauso Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Media Keywords:
Focuses: Cc:


Steps to Reproduce:

  1. Attach images to post using 'Add an Image' dialog
  2. Save post
  3. Go to Gallery tab under dialog
  4. Delete images
  5. View changes to 'From Computer' tab with only empty table from Gallery tab

Attachments (5)

Edit Post ‹ trunk — WordPress_1300476222657.png (59.3 KB) - added by hakre 13 years ago.
Edit Post ‹ trunk — WordPress_1300476603350.png (55.6 KB) - added by hakre 13 years ago.
16891.diff (4.1 KB) - added by garyc40 13 years ago.
16891.patch (3.5 KB) - added by hakre 13 years ago.
Reviewed Patch
16891.2.diff (3.4 KB) - added by kawauso 12 years ago.
Refreshed against [20375]

Download all attachments as: .zip

Change History (18)

#1 @hakre
13 years ago

Could reproduce (against trunk), did the upload to an existing post and did upload two images.

After deleting the last image, the display switched to the "From Computer" tab as shown in the screenshot:

Last edited 13 years ago by hakre (previous) (diff)

#2 @hakre
13 years ago

  • Keywords needs-patch added

13 years ago

#3 @garyc40
13 years ago

  • Component changed from Administration to Media
  • Keywords has-patch dev-feedback added; needs-patch removed

Patch attached that fixes the following problems:

  • When there's no item in the gallery, the action "media_upload_gallery" is fired before we actually check whether there should be a Gallery tab or not. As a result, when you delete everything, you get redirected to a page where there is no "Gallery" tab, but the Gallery list table is displayed.
  • When you upload images, then Save all changes, and proceed to delete one of them, somehow you got redirected to "From Computer" tab. The expected behavior is redirecting to Gallery tab instead. The fix is included in the patch I attached.

Can someone please confirm if this is a regression?

#4 @garyc40
13 years ago

  • Keywords 3.2-early added

OK, this is not a regression. Leave this for 3.2-early.

13 years ago

Reviewed Patch

#5 @hakre
13 years ago

Thanks for providing the patch. I could apply the patch to my trunk testbed and can confirm that it fixes the issue.

In the review of the patch, I corrected a minor issue. Static variables are NULL by default (as any unset variable in PHP), there is no need to explicitly set them to NULL:

static $attachments = null;

That's the only change in the new patch.

Version 0, edited 13 years ago by hakre (next)

12 years ago

Refreshed against [20375]

#6 @kawauso
12 years ago

  • Keywords 3.2-early removed
  • Milestone changed from Awaiting Review to 3.4

#7 @ryan
12 years ago

  • Milestone changed from 3.4 to Future Release

#8 @georgestephanis
12 years ago

  • Keywords reporter-feedback added

I just tried it against trunk at [21204] at can't seem to duplicate. As soon as I delete the last image, it automatically puts me back to the 'from computer' tab s it should be.

Can someone confirm that it's operational in trunk, and not just me?

#9 @SergeyBiryukov
12 years ago

  • Keywords reporter-feedback removed

As noted by garyc40 in comment:3, there are two issues:

  1. After deleting the last image, the "From Computer" tab is displayed with the wrong content.
  2. After deleting each image, the window redirects to the "From Computer" tab if "Save all changes" button was pressed on that tab earlier.

The first one was fixed in [18850] (and was a duplicate of #15118). The second one still remains.

#10 @georgestephanis
12 years ago

Gotcha, found it. Thanks.

#11 @georgestephanis
12 years ago

Patch still applies cleanly, and seems to solve the issue in my testing.

#12 @iseulde
11 years ago

  • Keywords has-patch dev-feedback removed
  • Resolution set to invalid
  • Status changed from new to closed

Media has been redone in 3.5.

#13 @helen
11 years ago

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.