Schedule actor delete comments

This commit is contained in:
Django Doucet 2023-11-13 10:29:53 -07:00
parent c47a47d5c9
commit c634bf2354

View file

@ -117,6 +117,18 @@ class Server {
$verified_request = Signature::verify_http_signature( $request );
if ( \is_wp_error( $verified_request ) ) {
$error_code = $verified_request->get_error_code();
if ( Application::is_actor_delete_request( $request ) && '404' === $error_code ) {
$actor = Application::is_known_actor( $request );
if ( wp_http_validate_url( $actor ) ) {
\wp_schedule_single_event(
\time(),
'activitypub_delete_remote_actor_comments',
array( $actor )
);
return $response;
}
}
return new WP_Error( 'activitypub_signature_verification', $verified_request->get_error_message(), array( 'status' => 401 ) );
}
} elseif ( 'GET' === $request->get_method() ) { // GET-Requests are only signed in secure mode