SIGN IN SIGN UP

RTC: Promote auto-draft posts on first autosave for collaborative sessions to avoid post loss.

When an RTC session in the editor saves edits on a draft post, they always save into an autosave revision. This prevents a sync but where storing to the post itself would lead to duplicate edits. This was set in wordpress/gutenberg commit 9df142b839320316b406ee1a02e23704d42f8719. However, there is an exception to this rule: the first session to save edits needs to promote the autosave revision into a real draft post, if a post doesn’t exist. The reason is that WordPress hides autosaves.

That is, multiple people could be editing a draft post and then once they close it, never be able to find it again. While the data is still in the database, this is a loss of the post from a practical standpoint.

This change introduces an exception where the first time a collaborative session is saving draft edits, the autodraft is promoted to a real draft post, making it visible in the post list.

AI Disclaimer: This bug was detected in a fuzzing system built by AI models and the fix was first proposed by an AI model.

Developed in: https://github.com/WordPress/gutenberg/pull/77865
Discussed in: https://core.trac.wordpress.org/ticket/65138
See also: https://github.com/WordPress/gutenberg/pull/77716

Follow-up to [61680].
Props danluu, dmsnell.
See #65138.


git-svn-id: https://develop.svn.wordpress.org/trunk@62311 602fd350-edb4-49c9-b593-d223f7449a82
D
Dennis Snell committed
8073f83239588fe61159071942ba8a359847d934
Parent: 3225987