Make WordPress Core

Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#29457 closed defect (bug) (fixed)

Saving a post with Quick Edit active on a comment results in the post not being saved

Reported by: druesome's profile druesome Owned by: chriscct7's profile chriscct7
Milestone: 4.3 Priority: normal
Severity: normal Version: 3.9
Component: Quick/Bulk Edit Keywords: has-patch commit
Focuses: Cc:

Description

While trying to save a post or page, and having Quick Edit open in the comments section, pressing the Update button results in the post not being saved and redirects to the Edit Posts Screen.

Steps to replicate:

  1. Edit any post or page that has at least one comment in the post editor.
  2. Make changes to the post content by typing in new text.
  3. Scroll down and click Quick Edit on any comment and leave it open.
  4. Scroll up and press the Update button.
  5. Expected: Post is saved and loads the post editor.

Actual: Post isn’t saved and loads the Edit Posts Screen (wp-admin/edit.php).

Attachments (1)

29457.patch (483 bytes) - added by polevaultweb 9 years ago.

Download all attachments as: .zip

Change History (11)

#1 @MikeHansenMe
9 years ago

  • Keywords needs-patch added

I was able to reproduce this using the steps described.

#2 @MikeHansenMe
9 years ago

So after some digging it seems strange but line 395 and 407 use c.after( editRow ) and without these the redirect does not happen. In fact if you pass string in place of editRow the string will show and the redirect will not happen. So that leads me to beleive it may be something with editRow. If anyone else has some ideas from there that would be great.

@polevaultweb
9 years ago

#3 @polevaultweb
9 years ago

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

The issue here is that when the quick edit or comment reply form is open, a comment <form> element is added within the post edit form, which also contains an input[name="action"] overriding the input[name="action"] value on the edit post form.

Patch added to close the comment reply/edit form, which removes the form from the post edit form on submission of the post.

Last edited 9 years ago by polevaultweb (previous) (diff)

#4 @chriscct7
9 years ago

  • Keywords needs-patch added; has-patch needs-testing removed
  • Version changed from 3.9.2 to 3.9

With the patch what it should do first is ensure that the comment hasn't been edited, or better confirm that you're going to lose the comment changes if you continue. If I change a comment while quick editing and forget to save it and then try to publish the post I'd lose my changes on the comment.

Once that is corrected, it looks good

#5 @polevaultweb
9 years ago

  • Keywords has-patch needs-testing 2nd-opinion added; needs-patch removed

@chriscct7 I agree, however, I think what you propose is outside the scope of the ticket.

If you quick edit a comment and then try to reload the page via the browser, any changes are lost and there is no prompt, unlike the post editor.

This patch fixes the update post bug, but adding change detection and prompt functionality for the post comments meta box feels like it should be in its own ticket. What do you think?

Last edited 9 years ago by polevaultweb (previous) (diff)

#6 @chriscct7
9 years ago

  • Keywords needs-testing 2nd-opinion removed
  • Milestone changed from Awaiting Review to 4.3
  • Owner set to chriscct7
  • Status changed from new to accepted

@polevaultweb Sure I'm good with that.

Last edited 9 years ago by chriscct7 (previous) (diff)

#7 @chriscct7
9 years ago

  • Keywords commit added

#8 @chriscct7
9 years ago

Ticket for comment:4 's proposal is #32818

Last edited 9 years ago by chriscct7 (previous) (diff)

#9 @obenland
9 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 33024:

Close comment quick edit before updating a post.

Fixes a bug where the user gets redirected to the All Posts screen, after
updating a post while quick editing a comment.

Props polevaultweb.
Fixes #29457.

#10 @obenland
9 years ago

In 33066:

Check if commentReply exists before trying to work with it.

Fixes a bug that caused the save/publish flow to be interrupted by an AYS.

Introduced in [33024].
See #29457.

Note: See TracTickets for help on using tickets.