From f2355cd9607c1d45708461cffcc230d8d2cdf3de Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Fri, 28 Apr 2023 11:23:40 +0200 Subject: [PATCH] fix typo --- includes/class-http.php | 2 +- includes/collection/class-followers.php | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/class-http.php b/includes/class-http.php index fd8df86..01c2042 100644 --- a/includes/class-http.php +++ b/includes/class-http.php @@ -40,7 +40,7 @@ class Http { 'body' => $body, ); - $response = \wp_safe_remote_get( $url, $args ); + $response = \wp_safe_remote_post( $url, $args ); $code = \wp_remote_retrieve_response_code( $response ); if ( 400 >= $code && 500 <= $code ) { diff --git a/includes/collection/class-followers.php b/includes/collection/class-followers.php index 597e0a7..0bd8d03 100644 --- a/includes/collection/class-followers.php +++ b/includes/collection/class-followers.php @@ -4,6 +4,7 @@ namespace Activitypub\Collection; use WP_Error; use Exception; use WP_Term_Query; +use Activitypub\Http; use Activitypub\Webfinger; use Activitypub\Model\Activity; use Activitypub\Model\Follower; @@ -269,6 +270,11 @@ class Followers { // @todo send error message //} + if ( isset( $object['user_id'] ) ) { + unset( $object['user_id'] ); + unset( $object['@context'] ); + } + // get inbox $inbox = $follower->get_inbox(); @@ -280,7 +286,7 @@ class Followers { $activity->set_id( \get_author_posts_url( $user_id ) . '#follow-' . \preg_replace( '~^https?://~', '', $actor ) ); $activity = $activity->to_simple_json(); - $response = safe_remote_post( $inbox, $activity, $user_id ); + $response = Http::post( $inbox, $activity, $user_id ); } /**