diff --git a/includes/class-activity-dispatcher.php b/includes/class-activity-dispatcher.php index 98904bc..f37e709 100644 --- a/includes/class-activity-dispatcher.php +++ b/includes/class-activity-dispatcher.php @@ -39,7 +39,7 @@ class Activity_Dispatcher { * @return void */ public static function send_activity_or_announce( WP_Post $wp_post, $type ) { - if ( is_user_disabled( Users::BLOG_USER_ID ) ) { + if ( is_user_type_disabled( 'blog' ) ) { return; } diff --git a/includes/functions.php b/includes/functions.php index ee67e16..80ed03e 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -401,7 +401,7 @@ function is_single_user() { $return = true; } - return apply_filters( 'activitypub_is_single_user', $return ); + return $return; } if ( ! function_exists( 'get_self_link' ) ) { diff --git a/tests/test-class-activitypub-activity-dispatcher.php b/tests/test-class-activitypub-activity-dispatcher.php index 54ebda0..b1eb3a0 100644 --- a/tests/test-class-activitypub-activity-dispatcher.php +++ b/tests/test-class-activitypub-activity-dispatcher.php @@ -95,6 +95,13 @@ class Test_Activitypub_Activity_Dispatcher extends ActivityPub_TestCase_Cache_HT } public function test_dispatch_announce() { + add_filter( + 'activitypub_is_user_type_disabled', + function( $value ) { + return false; + } + ); + $followers = array( 'https://example.com/author/jon' ); foreach ( $followers as $follower ) { @@ -131,12 +138,20 @@ class Test_Activitypub_Activity_Dispatcher extends ActivityPub_TestCase_Cache_HT $followers = array( 'https://example.com/author/jon' ); add_filter( - 'activitypub_is_single_user', - function( $return ) { - return true; - } + 'activitypub_is_user_type_disabled', + function( $value, $type ) { + if ( 'blog' === $type ) { + return false; + } else { + return true; + } + }, + 10, + 2 ); + $this->assertTrue( \Activitypub\is_single_user() ); + foreach ( $followers as $follower ) { \Activitypub\Collection\Followers::add_follower( \Activitypub\Collection\Users::BLOG_USER_ID, $follower ); }