Make WordPress Core

Opened 2 years ago

Last modified 17 months ago

#54983 new defect (bug)

The post has already been deleted.

Reported by: sumitsingh's profile sumitsingh Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.4
Component: Posts, Post Types Keywords: has-screenshots has-patch has-testing-info needs-testing dev-feedback
Focuses: administration Cc:

Description

Hi,

One big issue on 5.9 . when i have deleted post then still on post page & getting error message "The post has already been deleted.". So i think after delete post need to redirect page on post list?

More infomation you can see below mentioned quick video.
https://www.loom.com/share/616020077274422c8d90771034d22aff

Attachments (2)

54983_add_content_check.diff (672 bytes) - added by costdev 2 years ago.
Quick Draft: Add a check for $_POST['content'] before wrapping in Paragraph block markup.
54983.disable-submit.diff (1.2 KB) - added by costdev 2 years ago.
Disable the Submit button until the draft has either a title or content.

Download all attachments as: .zip

Change History (26)

This ticket was mentioned in Slack in #core by sumitsingh. View the logs.


2 years ago

#3 @sumitsingh
2 years ago

Our step like this :).

Steps to Reproduce

  1. Navigate to Dashboard > Quick Draft dashboard-widgets > Save Draft with enter anythings.
  2. Click on (no title) and will open edit post screen.
  3. On the Posts screen, Move to trash the post and still yuo will on edit post .
  4. Then try to again click on Move to trash then you will get error message "The post has already been deleted.".
Last edited 2 years ago by sumitsingh (previous) (diff)

#4 @sumitsingh
2 years ago

Our step like this :)

Steps to Reproduce

  1. Navigate to Dashboard > Quick Draft > Save Draft with enter anythings.
  2. Click on (no title) and will open edit post screen.
  3. On the Posts screen, Move to trash the post and still yuo will on edit post .
  4. Then try to again click on Move to trash then you will get error message "The post has already been deleted.".
Last edited 2 years ago by sumitsingh (previous) (diff)

#5 follow-up: @costdev
2 years ago

@sumitsingh Thanks for posting the steps to reproduce!

I can confirm that this issue only seems to occur when the post has no title and no content.

This does not occur when using the Classic Editor.
This still occurs with Gutenberg 12.4.1 activated.

This was unfortunately not covered for another issue with the "Move to trash" button in GB 17426.

@sumitsingh Can you double-check if this issue has been reported in the Gutenberg repo and if it hasn't, please open a bug report issue and comment here with a link to the issue?


In terms of the Quick Draft feature allowing a post with no title or content to be created:

  • This was introduced in 47191.
  • This change wrapped the content in a paragraph block if it didn't already contain one.
  • However, it did not confirm that there was any content to begin with.

I have reopened #48120 to address the regression.

Last edited 2 years ago by costdev (previous) (diff)

#6 in reply to: ↑ 5 @sumitsingh
2 years ago

I know about above but this is diffrent issue. here after click on Move to trash then show message or should be redirect on listing page @costdev . more information check my video on first comment. i think we need to set validation for atleast title for create post?

Replying to costdev:

@sumitsingh Thanks for posting the steps to reproduce!

I can confirm that this issue only seems to occur when the post has no title and no content.

This does not occur when using the Classic Editor.
This still occurs with Gutenberg 12.4.1 activated.

This was unfortunately not covered for another issue with the "Move to trash" button in GB 17426.

@sumitsingh Can you double-check if this issue has been reported in the Gutenberg repo and if it hasn't, please open a bug report issue and comment here with a link to the issue?


In terms of the Quick Draft feature allowing a post with no title or content to be created:

  • This was introduced in 47191.
  • This change wrapped the content in a paragraph block if it didn't already contain one.
  • However, it did not confirm that there was any content to begin with.

I have reopened #48120 to address the regression.

Last edited 2 years ago by sumitsingh (previous) (diff)

#7 @costdev
2 years ago

It's acceptable to create a post with no title OR no content, but wp_insert_post() does not allow a post to have no title AND no content.

<?php

$new_post = wp_insert_post( array( 'post_title' => '', 'post_content' => '' ) );
var_dump( $new_post ); // Will be (int) 0

However, the change in 47191 turns '' into <!-- wp:paragraph --><!-- /wp:paragraph --> for Quick Drafts, which means the post now has content and gets created. I submitted a patch to #48120 to resolve this, but I will move it to this ticket instead.

Last edited 2 years ago by costdev (previous) (diff)

@costdev
2 years ago

Quick Draft: Add a check for $_POST['content'] before wrapping in Paragraph block markup.

#9 @SergeyBiryukov
2 years ago

  • Milestone changed from Awaiting Review to 6.0

#10 @SergeyBiryukov
2 years ago

  • Focuses performance removed

#11 @mukesh27
2 years ago

Hi there!

54983_add_content_check.diff Is working fine and not allow to create Draft post without Post content.

Here can we show an alert message that tells the user that you have to add content to create a new Draft Post because no one understood what happen when they click on the Save Draft button

#12 @costdev
2 years ago

@mukesh27 After reading your comment, I went on the hunt for similar alert messages in Core for consistency. I couldn't find any that would appear in the form, except for red outlines added to the inputs. Highlighting both inputs wouldn't be accurate, as only one is needed for a valid post.

Alternatively, disabling the Submit button until the draft has either a title or content would be consistent with how the Block Editor works. I'll attach a patch for testing and review (remember to npm run build:dev).

@costdev
2 years ago

Disable the Submit button until the draft has either a title or content.

#13 @costdev
2 years ago

  • Keywords has-patch has-testing-info needs-testing added
  • Severity changed from major to normal
  • Version changed from 5.9 to 5.4

Patch still applies cleanly against trunk.

Last edited 2 years ago by costdev (previous) (diff)

This ticket was mentioned in Slack in #core-test by boniu91. View the logs.


23 months ago

#15 @ugyensupport
23 months ago

As @costdev have mentioned earlier in his comment, I would also like confirm that this issue only seems to occur when the post has no title and no content.

Last edited 23 months ago by ugyensupport (previous) (diff)

This ticket was mentioned in Slack in #core-test by boniu91. View the logs.


23 months ago

#17 @Boniu91
23 months ago

@costdev I tried to test the fix for QuickDraft, but it doesn't seem to wrok for me:
https://www.loom.com/share/33e5beb26c7346bf955f5bb82974ea0b

It's on the

54983.disable-submit.diff

#18 @rinkychowdhury9
23 months ago

  • Keywords dev-feedback added

@Boniu91 I agree with you. I have tested it also seems like not working for me.

@sumitsingh Also noticed that on first click no action is reflecting on the screen or redirecting to post list page. On second click it's displaying the message.

The post has already been deleted.

Please follow this screencast to view this actual behavior.

https://watch.screencastify.com/v/Z5caqJLwzULQRn3w2CRD

Tested on: WordPress version (6.0-beta2-53262)

This ticket was mentioned in Slack in #core-test by rinkychowdhury9. View the logs.


23 months ago

#20 @ugyensupport
23 months ago

@rinkychowdhury9 I would agree with you too, I could see the same result.

#21 @costdev
22 months ago

Sorry, I left out that you should run npm run build:dev after applying the patch.

This ticket was mentioned in Slack in #core by chaion07. View the logs.


22 months ago

#23 @costdev
22 months ago

  • Milestone changed from 6.0 to 6.1

With 6.0 RC1 starting soon, I'm moving this to the 6.1 milestone.

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


17 months ago

#25 @audrasjb
17 months ago

  • Milestone changed from 6.1 to Future Release

Unfortunately, this ticket didn’t get more momentum in 6.1 than in 6.0… sorry about that, but the proposed patch still needs testing, so let's move it to Future Release milestone, at least until it's properly reviewed and tested.

Note: See TracTickets for help on using tickets.