WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 8 months ago

Last modified 8 months ago

#16891 closed defect (bug) (invalid)

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

Reported by: kawauso Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Media Keywords:
Focuses: 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 3 years ago.
Edit Post ‹ trunk — WordPress_1300476603350.png (55.6 KB) - added by hakre 3 years ago.
16891.diff (4.1 KB) - added by garyc40 3 years ago.
16891.patch (3.5 KB) - added by hakre 3 years ago.
Reviewed Patch
16891.2.diff (3.4 KB) - added by kawauso 2 years ago.
Refreshed against [20375]

Download all attachments as: .zip

Change History (18)

comment:1 hakre3 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 3 years ago by hakre (previous) (diff)

comment:2 hakre3 years ago

  • Keywords needs-patch added

garyc403 years ago

comment:3 garyc403 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?

comment:4 garyc403 years ago

  • Keywords 3.2-early added

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

hakre3 years ago

Reviewed Patch

comment:5 hakre3 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, there is no need to explicitly set them to NULL:

static $attachments = null;

That's the only change in the new patch.

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

kawauso2 years ago

Refreshed against [20375]

comment:6 kawauso2 years ago

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

comment:7 ryan2 years ago

  • Milestone changed from 3.4 to Future Release

comment:8 georgestephanis22 months 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?

comment:9 SergeyBiryukov22 months 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.

comment:10 georgestephanis22 months ago

Gotcha, found it. Thanks.

comment:11 georgestephanis22 months ago

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

comment:12 avryl8 months ago

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

Media has been redone in 3.5.

comment:13 helen8 months ago

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