From 626203002a3f58caf9ab576b895e4662b07b027c Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Fri, 11 Aug 2023 09:24:45 +0200 Subject: [PATCH] only include the minimum required fields for Accept call --- includes/collection/class-followers.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/includes/collection/class-followers.php b/includes/collection/class-followers.php index f28a17a0..baadf09d 100644 --- a/includes/collection/class-followers.php +++ b/includes/collection/class-followers.php @@ -265,11 +265,18 @@ class Followers { return; } - if ( isset( $object['user_id'] ) ) { - unset( $object['user_id'] ); - } - - unset( $object['@context'] ); + // only send minimal data + $object = array_intersect_key( + $object, + array_flip( + array( + 'id', + 'type', + 'actor', + 'object', + ) + ) + ); $user = Users::get_by_id( $user_id ); @@ -282,7 +289,7 @@ class Followers { $activity->set_object( $object ); $activity->set_actor( $user->get_id() ); $activity->set_to( $actor ); - $activity->set_id( $user->get_id() . '#follow-' . \preg_replace( '~^https?://~', '', $actor ) ); + $activity->set_id( $user->get_id() . '#follow-' . \preg_replace( '~^https?://~', '', $actor ) . '-' . \time() ); $activity = $activity->to_json();