PluginProbe
Gutenberg / trunk
Gutenberg vtrunk
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | lib/experimental/collaboration/rest-api.php +8 -7 23.7.0 → trunk View file →
@@ -8,21 +8,22 @@
8 8 /**
9 9 * Overrides the default REST controller for autosaves to fix real-time
10 10 * collaboration on draft posts.
11 11 *
12 - * When RTC is enabled, draft autosaves from all users update the post directly
13 - * instead of creating per-user autosave revisions depending on post lock and
14 - * assigned author.
12 + * When RTC is enabled, regular draft autosaves are stored as revisions instead
13 + * of updating the parent post based on its lock and author. Auto-drafts are
14 + * still promoted to drafts.
15 15 *
16 - * Only overrides when autosave_rest_controller_class is not explicitly set,
17 - * i.e. when WP_REST_Autosaves_Controller would be used by default. Post types
18 - * with their own specialized autosave controller (e.g. templates) are left alone.
16 + * Only overrides when RTC is enabled and autosave_rest_controller_class is not
17 + * explicitly set, i.e. when WP_REST_Autosaves_Controller would be used by
18 + * default. Post types with their own specialized autosave controller (e.g.
19 + * templates) are left alone.
19 20 *
20 21 * @param array $args Array of arguments for registering a post type.
21 22 * @return array Modified array of arguments.
22 23 */
23 24 function gutenberg_override_autosaves_rest_controller( $args ) {
24 - if ( empty( $args['autosave_rest_controller_class'] ) ) {
25 + if ( empty( $args['autosave_rest_controller_class'] ) && wp_is_collaboration_enabled() ) {
25 26 $args['autosave_rest_controller_class'] = 'Gutenberg_REST_Autosaves_Controller';
26 27 }
27 28 return $args;
28 29 }