Make WordPress Core

Opened 13 years ago

Closed 18 months ago

Last modified 14 months ago

#19907 closed defect (bug) (fixed)

Updating an unpublished draft post in quick-edit mode sets the post's publish date

Reported by: uxtremist's profile uxtremist Owned by: joedolson's profile joedolson
Milestone: 6.3 Priority: normal
Severity: major Version: 2.7
Component: Quick/Bulk Edit Keywords: has-patch editorial-flow has-unit-tests needs-testing commit
Focuses: Cc:

Description

Problem:

  • If you update an unpublished draft post in quick-edit mode, the post's publish date is saved.
  • Then, later on, when you actually publish the post, its publish date is incorrect.

Suggested fix:

  • If the post is a draft, do not automatically set the post's publish date in quick-edit mode.

Steps to reproduce:

(1) Go to WP-Admin -> Posts.

(2) Create and save a new post. Make sure you click "Save Draft" — not "Publish".

(3) Note that the post is marked as "Publish immediately"; that is, it has no publish date.

(4) Go back to WP-Admin -> Posts.

(5) Hover your pointer over the post you just created. Click "Quick Edit".

— Note that in the panel that appears, the "Date" field is automatically set to [the current date and time].

(6) Click "Update" in quick-edit mode.

(7) Hover your pointer over the post you just updated. Click "Edit".

— Note that in the Edit Post page that appears, the post is now marked as "Publish on: [the date and time from step (5)]"

Attachments (4)

19907.patch (627 bytes) - added by SergeyBiryukov 13 years ago.
19907.2.patch (626 bytes) - added by SergeyBiryukov 13 years ago.
27578.diff (519 bytes) - added by Denis-de-Bernardy 11 years ago.
Alternative fix, which also fixes the issue when a draft post is trashed or untrashed
19907.3.patch (2.4 KB) - added by Mista-Flo 4 years ago.

Download all attachments as: .zip

Change History (46)

#1 @nacin
13 years ago

  • Milestone changed from Awaiting Review to 3.4
  • Severity changed from normal to major

#2 @SergeyBiryukov
13 years ago

  • Keywords has-patch added; needs-patch removed
  • Version changed from 3.3.1 to 2.7

Has been this way since Quick Edit was introduced in 2.7 (#8144).

The problem is that edit_date is true by default:
http://core.trac.wordpress.org/browser/tags/3.3.1/wp-admin/js/inline-edit-post.dev.js#L238
And the condition for $clear_date in wp_update_post() is not satisfied:
http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/post.php#L2693

19907.patch brings the similar check and comment into edit_post().

19907.2.patch sets edit_date to false instead of post_date_gmt.

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

#3 @jane
13 years ago

  • Keywords ux-feedback removed

I don't know that I'd call it major, since it's been there since 2.7, but the desired behavior is that when using quick edit when a post is a draft, it should adjust 'last edited' not 'publish' time.

#4 @nacin
13 years ago

Closely related, #16985.

#5 @nacin
13 years ago

  • Keywords needs-unit-tests added

#6 @nacin
13 years ago

  • Keywords punt added

Needs unit tests. Thinking punt.

#7 @ryan
13 years ago

  • Milestone changed from 3.4 to Future Release

#9 @SergeyBiryukov
12 years ago

  • Keywords punt removed

#10 @navjotjsingh
12 years ago

  • Cc navjotjsingh@… added

#11 @SergeyBiryukov
12 years ago

  • Keywords editorial-flow added

#12 @mintindeed
11 years ago

  • Cc gabriel.koen@… added

#13 @SergeyBiryukov
11 years ago

#27578 was marked as a duplicate.

@Denis-de-Bernardy
11 years ago

Alternative fix, which also fixes the issue when a draft post is trashed or untrashed

#14 @Denis-de-Bernardy
11 years ago

#22350 was marked as a duplicate.

#15 @Denis-de-Bernardy
11 years ago

I've closed #22350 as dup, since the patch I just uploaded fixes both.

#16 @georgestephanis
11 years ago

Patch will need to be rewritten to apply cleanly with the current core php brace syntax mandate. Anyone want easy props to rewrite?

#17 @SergeyBiryukov
11 years ago

  • Milestone changed from Future Release to 4.0

#18 @SergeyBiryukov
10 years ago

#28522 was marked as a duplicate.

This ticket was mentioned in IRC in #wordpress-dev by DrewAPicture. View the logs.


10 years ago

#20 @DrewAPicture
10 years ago

  • Milestone changed from 4.0 to Future Release

Patch applies with fuzz. Still needs unit tests. Punting.

#21 @chriscct7
9 years ago

  • Keywords needs-refresh added

Patch no longer applies

#22 @SergeyBiryukov
7 years ago

#39025 was marked as a duplicate.

#23 @SergeyBiryukov
7 years ago

#42159 was marked as a duplicate.

#24 @SergeyBiryukov
4 years ago

#50951 was marked as a duplicate.

#25 @rfischmann
4 years ago

Wow, 9 years!

Because of this issue inserting tags on Gutenberg, I almost prefer to insert them using the quick editor.

That way, this does bug me quite a lot. Hope it gets fixed soon.

@Mista-Flo
4 years ago

#26 @Mista-Flo
4 years ago

  • Keywords has-unit-tests added; needs-unit-tests needs-refresh removed

I can still reproduce the issue on trunk version.

I tested the first implementation by @SergeyBiryukov but it doesn't seem to work for me. So I tested the second implementation and it worked. But I'm afraid the patch might have some regressions.

There are two failing unit tests with the second patch:

Tests_XMLRPC_wp_newPost::test_valid_string_post_date_gmt
Tests_XMLRPC_wp_newPost::test_valid_IXR_post_date_gmt

--- Expected
+++ Actual
@@ @@
-'1984-01-11 05:00:00'
+'0000-00-00 00:00:00'

I also tried to create a unit test dedicated to this ticket, a bit struggling as it's an AJAX request but I think I have something working.

Be cautious this patch is not ready to be committed as the XMLRPC is impacted. Let's get some feedback

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


3 years ago

#28 @joedolson
21 months ago

  • Milestone changed from Future Release to 6.3
  • Owner set to joedolson
  • Status changed from new to accepted

I'm going to tackle this for 6.3; it would go nicely along with some related tickets I've already committed this cycle.

This ticket was mentioned in PR #4262 on WordPress/wordpress-develop by rutviksavsani.


21 months ago
#29

Trac ticket:

rutviksavsani commented on PR #4262:


21 months ago
#30

Closing the Pull request.

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


18 months ago

This ticket was mentioned in PR #4533 on WordPress/wordpress-develop by @rutviksavsani.


18 months ago
#32

Trac ticket: https://core.trac.wordpress.org/ticket/19907

In this PR, we are disabling saving of date when a draft post is being saved in the quik-editor for posts.

#33 @rutviksavsani
18 months ago

  • Keywords needs-testing added

I have added a PR https://github.com/WordPress/wordpress-develop/pull/4533 that should fix the issue.

Edit:
As expected this was not a total PHP backend fix, As We needed to tweak the JS to pass edit_date param as false. By default it always passed true and that was the reason the date was getting updated.

Last edited 18 months ago by rutviksavsani (previous) (diff)

#34 @oglekler
18 months ago

Hi @rutviksavsani, thank you for the patch.

I tested it, and it looks like we still have the date settled after a quick edit update.
Video: https://disk.yandex.ru/i/6n_PVNs2W_xZgA

#35 @oglekler
18 months ago

@rutviksavsani, sorry for the inconvenience, I forgot to run a build 🤦 but even after this I managed to get expected result from the second attempt after clearing browser's cache. So, right now this is an issue if fixed with the patch ✅

Thank you 🙏

This ticket was mentioned in PR #4686 on WordPress/wordpress-develop by @joedolson.


18 months ago
#36

This is for testing the tests being added for 19907. Should fail.

Trac ticket: https://core.trac.wordpress.org/ticket/19907

#37 @joedolson
18 months ago

  • Keywords commit added

New PR merges @ruviksavsani's PR with the tests added by @Mista-Flo (with a minor tweak).

#38 @joedolson
18 months ago

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

In 56022:

Quick/Bulk Edit: Don't set publish date when editing drafts.

Ensure that quick edit does not define a publish date if the post status is one of 'draft', 'pending', or 'auto-draft'.

Props uxtremist, SergeyBiryukov, Denis-de-Bernardy, jane, rfischmann, mista-flo, rutviksavsani, oglekler, joedolson.
Fixes #19907.

@joedolson commented on PR #4533:


18 months ago
#39

Fixed in r56022

@joedolson commented on PR #4686:


18 months ago
#40

Closed in r56022

#41 @tristanleboss
16 months ago

I am not sure this ticket was implemented the right way.

See my comment here: https://core.trac.wordpress.org/ticket/59125#comment:4

#42 @joedolson
14 months ago

In 56802:

Quick/Bulk Edit: Fix inability to quick edit draft post date.

Follow up to [56022] to fix inability to set a date/time in quick editing. Allow a user to set a quick/edit date while preventing accidental date assignments per the original intent.

Props tristanleboss, ivanzhuck, tibbsa, sabernhardt, sergeybiryukov, oandregal, khokansardar, joedolson, shailu25.
Fixes #59125. See #19907.

Note: See TracTickets for help on using tickets.