From d997833f461b9e45c5a4c372c5f3e96aca26afb9 Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Mon, 20 Jul 2026 18:32:26 +0900 Subject: [PATCH 1/2] Move real-time collaboration code to lib/experimental/collaboration RTC is not part of WordPress 7.1, and whether it lands in a future release is still undecided. Move the sync/save servers, storage, the collaboration bootstrap, the RTC autosaves controller and its REST override, and the RTC meta-box compat out of compat/wordpress-7.1 into a dedicated experimental/collaboration directory. The autosaves controller extends WP_REST_Autosaves_Controller, so it stays inside the class_exists( 'WP_REST_Controller' ) guard; the meta-box compat moves to the unconditional Experimental features section. Co-Authored-By: Claude --- lib/compat/wordpress-7.1/rest-api.php | 24 --------------- ...ss-gutenberg-rest-autosaves-controller.php | 0 .../class-wp-http-polling-sync-server.php | 0 .../collaboration}/class-wp-sync-config.php | 0 .../class-wp-sync-post-meta-storage.php | 0 .../class-wp-sync-save-server.php | 0 .../collaboration}/collaboration.php | 0 .../interface-wp-sync-storage.php | 0 .../collaboration}/meta-box-rtc-compat.php | 0 lib/experimental/collaboration/rest-api.php | 30 +++++++++++++++++++ lib/load.php | 12 ++++---- 11 files changed, 37 insertions(+), 29 deletions(-) rename lib/{compat/wordpress-7.1 => experimental/collaboration}/class-gutenberg-rest-autosaves-controller.php (100%) rename lib/{compat/wordpress-7.1 => experimental/collaboration}/class-wp-http-polling-sync-server.php (100%) rename lib/{compat/wordpress-7.1 => experimental/collaboration}/class-wp-sync-config.php (100%) rename lib/{compat/wordpress-7.1 => experimental/collaboration}/class-wp-sync-post-meta-storage.php (100%) rename lib/{compat/wordpress-7.1 => experimental/collaboration}/class-wp-sync-save-server.php (100%) rename lib/{compat/wordpress-7.1 => experimental/collaboration}/collaboration.php (100%) rename lib/{compat/wordpress-7.1 => experimental/collaboration}/interface-wp-sync-storage.php (100%) rename lib/{compat/wordpress-7.1 => experimental/collaboration}/meta-box-rtc-compat.php (100%) create mode 100644 lib/experimental/collaboration/rest-api.php diff --git a/lib/compat/wordpress-7.1/rest-api.php b/lib/compat/wordpress-7.1/rest-api.php index 97ae142ff5745a..2362b086e06ec7 100644 --- a/lib/compat/wordpress-7.1/rest-api.php +++ b/lib/compat/wordpress-7.1/rest-api.php @@ -73,27 +73,3 @@ function gutenberg_override_attachments_rest_controller( $args, $post_type ) { return $args; } add_filter( 'register_post_type_args', 'gutenberg_override_attachments_rest_controller', 10, 2 ); - -/** - * Overrides the default REST controller for autosaves to fix real-time - * collaboration on draft posts. - * - * When RTC is enabled, draft autosaves from all users update the post directly - * instead of creating per-user autosave revisions depending on post lock and - * assigned author. - * - * Only overrides when autosave_rest_controller_class is not explicitly set, - * i.e. when WP_REST_Autosaves_Controller would be used by default. Post types - * with their own specialized autosave controller (e.g. templates) are left alone. - * - * @param array $args Array of arguments for registering a post type. - * @return array Modified array of arguments. - */ -function gutenberg_override_autosaves_rest_controller( $args ) { - if ( empty( $args['autosave_rest_controller_class'] ) ) { - $args['autosave_rest_controller_class'] = 'Gutenberg_REST_Autosaves_Controller'; - } - return $args; -} - -add_filter( 'register_post_type_args', 'gutenberg_override_autosaves_rest_controller', 10, 1 ); diff --git a/lib/compat/wordpress-7.1/class-gutenberg-rest-autosaves-controller.php b/lib/experimental/collaboration/class-gutenberg-rest-autosaves-controller.php similarity index 100% rename from lib/compat/wordpress-7.1/class-gutenberg-rest-autosaves-controller.php rename to lib/experimental/collaboration/class-gutenberg-rest-autosaves-controller.php diff --git a/lib/compat/wordpress-7.1/class-wp-http-polling-sync-server.php b/lib/experimental/collaboration/class-wp-http-polling-sync-server.php similarity index 100% rename from lib/compat/wordpress-7.1/class-wp-http-polling-sync-server.php rename to lib/experimental/collaboration/class-wp-http-polling-sync-server.php diff --git a/lib/compat/wordpress-7.1/class-wp-sync-config.php b/lib/experimental/collaboration/class-wp-sync-config.php similarity index 100% rename from lib/compat/wordpress-7.1/class-wp-sync-config.php rename to lib/experimental/collaboration/class-wp-sync-config.php diff --git a/lib/compat/wordpress-7.1/class-wp-sync-post-meta-storage.php b/lib/experimental/collaboration/class-wp-sync-post-meta-storage.php similarity index 100% rename from lib/compat/wordpress-7.1/class-wp-sync-post-meta-storage.php rename to lib/experimental/collaboration/class-wp-sync-post-meta-storage.php diff --git a/lib/compat/wordpress-7.1/class-wp-sync-save-server.php b/lib/experimental/collaboration/class-wp-sync-save-server.php similarity index 100% rename from lib/compat/wordpress-7.1/class-wp-sync-save-server.php rename to lib/experimental/collaboration/class-wp-sync-save-server.php diff --git a/lib/compat/wordpress-7.1/collaboration.php b/lib/experimental/collaboration/collaboration.php similarity index 100% rename from lib/compat/wordpress-7.1/collaboration.php rename to lib/experimental/collaboration/collaboration.php diff --git a/lib/compat/wordpress-7.1/interface-wp-sync-storage.php b/lib/experimental/collaboration/interface-wp-sync-storage.php similarity index 100% rename from lib/compat/wordpress-7.1/interface-wp-sync-storage.php rename to lib/experimental/collaboration/interface-wp-sync-storage.php diff --git a/lib/compat/wordpress-7.1/meta-box-rtc-compat.php b/lib/experimental/collaboration/meta-box-rtc-compat.php similarity index 100% rename from lib/compat/wordpress-7.1/meta-box-rtc-compat.php rename to lib/experimental/collaboration/meta-box-rtc-compat.php diff --git a/lib/experimental/collaboration/rest-api.php b/lib/experimental/collaboration/rest-api.php new file mode 100644 index 00000000000000..b22157dea26857 --- /dev/null +++ b/lib/experimental/collaboration/rest-api.php @@ -0,0 +1,30 @@ + Date: Mon, 20 Jul 2026 18:48:50 +0900 Subject: [PATCH 2/2] Use 'default' text domain for reused core strings in collaboration row actions The "Edit “%s”" and "Edit" strings reuse WordPress Core translations, so pass the 'default' text domain explicitly to satisfy WordPress.WP.I18n.MissingArgDomainDefault and reuse core's existing translations. Co-Authored-By: Claude --- lib/experimental/collaboration/collaboration.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/experimental/collaboration/collaboration.php b/lib/experimental/collaboration/collaboration.php index b2c36781394808..14481554c5d9bd 100644 --- a/lib/experimental/collaboration/collaboration.php +++ b/lib/experimental/collaboration/collaboration.php @@ -580,8 +580,8 @@ function gutenberg_post_list_collaboration_row_actions( $actions, $post ) { . '%5$s', esc_url( get_edit_post_link( $post->ID ) ), /* translators: %s: Post title. */ - esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ), - __( 'Edit' ), + esc_attr( sprintf( __( 'Edit “%s”', 'default' ), $title ) ), + __( 'Edit', 'default' ), /* translators: %s: Post title. */ esc_attr( sprintf( __( 'Join editing “%s”', 'gutenberg' ), $title ) ), /* translators: Action link text for a singular post in the post list. Can be any type of post. */