WordPress.org

Make WordPress Core

Opened 14 months ago

Last modified 14 months ago

#43760 new enhancement

Create a revision when autosaving if the content has changed significantly

Reported by: azaozz Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Autosave Keywords: has-patch needs-testing has-unit-tests
Focuses: Cc:

Description

Sometimes a user may edit a post for hours without saving it. We have autosaves to prevent any data loss. However in some cases there may be an user or a server error and the content may not be submitted or the post may be "empty". This doesn't happen often, but is usually devastating for the users. They just lost hours of work!

To safeguard against these cases, we can create post revisions when the autosave data is significantly different than the existing post.

Attachments (2)

43760.patch (3.0 KB) - added by azaozz 14 months ago.
43760.1.diff (5.0 KB) - added by soulseekah 14 months ago.
diff-based implementation

Download all attachments as: .zip

Change History (4)

@azaozz
14 months ago

#1 @azaozz
14 months ago

  • Keywords has-patch needs-testing added

@soulseekah
14 months ago

diff-based implementation

#2 @soulseekah
14 months ago

  • Keywords has-unit-tests added

Interesting.

43760.1.diff is my version for a diff-based implementation instead. Just as an idea with some tests that can also be repurposed for your patch.

Also, a suggestion on the wp_create_revision_for_autosave filter: I think should send in the $post_data and $autosave_data, the count probably useless as users would be using their own heuristics.

Thoughts?

Note: See TracTickets for help on using tickets.