diff --git a/integration/class-friends-feed-parser-activitypub.php b/integration/class-friends-feed-parser-activitypub.php index e360c08..a59546b 100644 --- a/integration/class-friends-feed-parser-activitypub.php +++ b/integration/class-friends-feed-parser-activitypub.php @@ -413,7 +413,11 @@ class Friends_Feed_Parser_ActivityPub extends \Friends\Feed_Parser { public function get_possible_mentions() { static $users = null; - if ( is_null( $users ) || true ) { + if ( ! method_exists( '\Friends\User_Feed', 'get_by_parser' ) ) { + return array(); + } + + if ( is_null( $users ) || ! apply_filters( 'activitypub_cache_possible_friend_mentions', true ) ) { $feeds = \Friends\User_Feed::get_by_parser( 'activitypub' ); $users = array(); foreach ( $feeds as $feed ) { diff --git a/tests/test-class-friends-feed-parser-activitypub.php b/tests/test-class-friends-feed-parser-activitypub.php index 889d43b..55a4230 100644 --- a/tests/test-class-friends-feed-parser-activitypub.php +++ b/tests/test-class-friends-feed-parser-activitypub.php @@ -163,6 +163,7 @@ class Test_Friends_Feed_Parser_ActivityPub extends ActivityPub_TestCase_Cache_HT } public function test_friend_mentions() { + add_filter( 'friends_cache_possible_mentions', '__return_false' ); $post = \wp_insert_post( array( 'post_author' => 1, @@ -188,6 +189,8 @@ class Test_Friends_Feed_Parser_ActivityPub extends ActivityPub_TestCase_Cache_HT $this->assertContains( $this->actor, $activitypub_activity->get_cc() ); remove_all_filters( 'activitypub_from_post_object' ); + remove_all_filters( 'activitypub_cache_possible_friend_mentions' ); + \wp_trash_post( $post ); }