This commit is contained in:
Matthias Pfefferle 2023-04-28 11:23:40 +02:00
parent 5ef41dea02
commit f2355cd960
2 changed files with 8 additions and 2 deletions

View file

@ -40,7 +40,7 @@ class Http {
'body' => $body, 'body' => $body,
); );
$response = \wp_safe_remote_get( $url, $args ); $response = \wp_safe_remote_post( $url, $args );
$code = \wp_remote_retrieve_response_code( $response ); $code = \wp_remote_retrieve_response_code( $response );
if ( 400 >= $code && 500 <= $code ) { if ( 400 >= $code && 500 <= $code ) {

View file

@ -4,6 +4,7 @@ namespace Activitypub\Collection;
use WP_Error; use WP_Error;
use Exception; use Exception;
use WP_Term_Query; use WP_Term_Query;
use Activitypub\Http;
use Activitypub\Webfinger; use Activitypub\Webfinger;
use Activitypub\Model\Activity; use Activitypub\Model\Activity;
use Activitypub\Model\Follower; use Activitypub\Model\Follower;
@ -269,6 +270,11 @@ class Followers {
// @todo send error message // @todo send error message
//} //}
if ( isset( $object['user_id'] ) ) {
unset( $object['user_id'] );
unset( $object['@context'] );
}
// get inbox // get inbox
$inbox = $follower->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->set_id( \get_author_posts_url( $user_id ) . '#follow-' . \preg_replace( '~^https?://~', '', $actor ) );
$activity = $activity->to_simple_json(); $activity = $activity->to_simple_json();
$response = safe_remote_post( $inbox, $activity, $user_id ); $response = Http::post( $inbox, $activity, $user_id );
} }
/** /**