From 921ca0c1c65699880b120e2d29340c6f0108e9b1 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Tue, 25 Jul 2023 10:47:59 +0200 Subject: [PATCH] fix actions --- includes/rest/class-followers.php | 2 +- includes/rest/class-following.php | 2 +- includes/rest/class-inbox.php | 2 +- includes/rest/class-nodeinfo.php | 16 ++++++++++++++-- includes/rest/class-outbox.php | 2 +- includes/rest/class-users.php | 2 +- includes/rest/class-webfinger.php | 5 +++++ 7 files changed, 24 insertions(+), 7 deletions(-) diff --git a/includes/rest/class-followers.php b/includes/rest/class-followers.php index cdff551..03d3c2a 100644 --- a/includes/rest/class-followers.php +++ b/includes/rest/class-followers.php @@ -63,7 +63,7 @@ class Followers { /* * Action triggerd prior to the ActivityPub profile being created and sent to the client */ - \do_action( 'activitypub_outbox_pre' ); + \do_action( 'activitypub_rest_followers_pre' ); $json = new stdClass(); diff --git a/includes/rest/class-following.php b/includes/rest/class-following.php index 29e7e07..cd77007 100644 --- a/includes/rest/class-following.php +++ b/includes/rest/class-following.php @@ -56,7 +56,7 @@ class Following { /* * Action triggerd prior to the ActivityPub profile being created and sent to the client */ - \do_action( 'activitypub_outbox_pre' ); + \do_action( 'activitypub_rest_following_pre' ); $json = new \stdClass(); diff --git a/includes/rest/class-inbox.php b/includes/rest/class-inbox.php index e4bef21..f3df5c9 100644 --- a/includes/rest/class-inbox.php +++ b/includes/rest/class-inbox.php @@ -85,7 +85,7 @@ class Inbox { /* * Action triggerd prior to the ActivityPub profile being created and sent to the client */ - \do_action( 'activitypub_inbox_pre' ); + \do_action( 'activitypub_rest_inbox_pre' ); $json = new \stdClass(); diff --git a/includes/rest/class-nodeinfo.php b/includes/rest/class-nodeinfo.php index 1d9de67..711d4fd 100644 --- a/includes/rest/class-nodeinfo.php +++ b/includes/rest/class-nodeinfo.php @@ -1,6 +1,8 @@ array(), ); - return new \WP_REST_Response( $nodeinfo, 200 ); + return new WP_REST_Response( $nodeinfo, 200 ); } /** @@ -119,6 +126,11 @@ class Nodeinfo { * @return WP_REST_Response */ public static function nodeinfo2( $request ) { + /* + * Action triggerd prior to the ActivityPub profile being created and sent to the client + */ + \do_action( 'activitypub_rest_nodeinfo2_pre' ); + $nodeinfo = array(); $nodeinfo['version'] = '1.0'; @@ -160,7 +172,7 @@ class Nodeinfo { 'outbound' => array(), ); - return new \WP_REST_Response( $nodeinfo, 200 ); + return new WP_REST_Response( $nodeinfo, 200 ); } /** diff --git a/includes/rest/class-outbox.php b/includes/rest/class-outbox.php index 047ae22..a0d06a9 100644 --- a/includes/rest/class-outbox.php +++ b/includes/rest/class-outbox.php @@ -66,7 +66,7 @@ class Outbox { /* * Action triggerd prior to the ActivityPub profile being created and sent to the client */ - \do_action( 'activitypub_outbox_pre' ); + \do_action( 'activitypub_rest_outbox_pre' ); $json = new stdClass(); diff --git a/includes/rest/class-users.php b/includes/rest/class-users.php index b4f85fe..b678043 100644 --- a/includes/rest/class-users.php +++ b/includes/rest/class-users.php @@ -66,7 +66,7 @@ class Users { /* * Action triggerd prior to the ActivityPub profile being created and sent to the client */ - \do_action( 'activitypub_outbox_pre' ); + \do_action( 'activitypub_rest_users_pre' ); $user->set_context( Activity::CONTEXT diff --git a/includes/rest/class-webfinger.php b/includes/rest/class-webfinger.php index 8e651d0..4504e0d 100644 --- a/includes/rest/class-webfinger.php +++ b/includes/rest/class-webfinger.php @@ -52,6 +52,11 @@ class Webfinger { * @return WP_REST_Response The response object. */ public static function webfinger( $request ) { + /* + * Action triggerd prior to the ActivityPub profile being created and sent to the client + */ + \do_action( 'activitypub_rest_webfinger_pre' ); + $resource = $request->get_param( 'resource' ); $response = self::get_profile( $resource );