Opened 2 years ago

Last modified 11 months ago

#16891 new defect (bug)

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

Reported by: kawauso Owned by:
Priority: normal Milestone: Future Release
Component: Media Version: 3.1
Severity: normal Keywords: has-patch dev-feedback
Cc:

Description

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 2 years ago.
Edit Post ‹ trunk — WordPress_1300476603350.png (55.6 KB) - added by hakre 2 years ago.
16891.diff (4.1 KB) - added by garyc40 2 years ago.
16891.patch (3.5 KB) - added by hakre 2 years ago.
Reviewed Patch
16891.2.diff (3.4 KB) - added by kawauso 14 months ago.
Refreshed against [20375]

Download all attachments as: .zip

Change History (16)

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 2 years ago by hakre (previous) (diff)
  • Keywords needs-patch added

garyc402 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?

  • Keywords 3.2-early added

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

hakre2 years ago

Reviewed Patch

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 2 years ago by hakre (next)

Refreshed against [20375]

  • Keywords 3.2-early removed
  • Milestone changed from Awaiting Review to 3.4
  • Milestone changed from 3.4 to Future Release
  • 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?

  • 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.

Gotcha, found it. Thanks.

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

Note: See TracTickets for help on using tickets.