From 0cf8b91c11896978fefa59c86e2130f2e48d81c2 Mon Sep 17 00:00:00 2001 From: Matt Wiebe Date: Fri, 24 Jan 2025 13:25:23 -0600 Subject: [PATCH] do not migrate outbox items. fix tests --- includes/class-activitypub.php | 22 ++++++++++++---------- tests/includes/class-test-migration.php | 10 +++++++++- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/includes/class-activitypub.php b/includes/class-activitypub.php index c62a300d9..26bd6af66 100644 --- a/includes/class-activitypub.php +++ b/includes/class-activitypub.php @@ -523,21 +523,23 @@ private static function register_post_types() { register_post_type( Outbox::POST_TYPE, array( - 'labels' => array( + 'labels' => array( 'name' => _x( 'Outbox', 'post_type plural name', 'activitypub' ), 'singular_name' => _x( 'Outbox Item', 'post_type single name', 'activitypub' ), ), - 'capabilities' => array( + 'capabilities' => array( 'create_posts' => false, ), - 'map_meta_cap' => true, - 'public' => true, - 'hierarchical' => true, - 'rewrite' => false, - 'query_var' => false, - 'delete_with_user' => true, - 'can_export' => true, - 'supports' => array(), + 'map_meta_cap' => true, + 'public' => true, + 'hierarchical' => true, + 'rewrite' => false, + 'query_var' => false, + 'delete_with_user' => true, + 'can_export' => true, + 'supports' => array(), + 'exclude_from_search' => true, + 'menu_icon' => 'dashicons-networking', ) ); diff --git a/tests/includes/class-test-migration.php b/tests/includes/class-test-migration.php index ca0d8c35e..7a27de9e0 100644 --- a/tests/includes/class-test-migration.php +++ b/tests/includes/class-test-migration.php @@ -34,7 +34,13 @@ public static function set_up_before_class() { \remove_action( 'wp_insert_comment', array( \Activitypub\Scheduler\Comment::class, 'schedule_comment_activity_on_insert' ) ); // Create test posts. - self::$fixtures['posts'] = self::factory()->post->create_many( 3, array( 'post_author' => 1 ) ); + self::$fixtures['posts'] = self::factory()->post->create_many( + 3, + array( + 'post_author' => 1, + 'meta_input' => array( 'activitypub_status' => 'federated' ), + ) + ); $modified_post_id = self::factory()->post->create( array( @@ -43,6 +49,7 @@ public static function set_up_before_class() { 'post_status' => 'publish', 'post_type' => 'post', 'post_date' => '2020-01-01 00:00:00', + 'meta_input' => array( 'activitypub_status' => 'federated' ), ) ); self::factory()->post->update_object( $modified_post_id, array( 'post_content' => 'Test post 2 updated' ) ); @@ -77,6 +84,7 @@ public static function set_up_before_class() { 'comment_approved' => '1', ) ); + \add_comment_meta( self::$fixtures['comment'], 'activitypub_status', 'federated' ); } /**