only include the minimum required fields for Accept call

This commit is contained in:
Matthias Pfefferle 2023-08-11 09:24:45 +02:00
parent 30eb07ba17
commit 626203002a

View file

@ -265,11 +265,18 @@ class Followers {
return; return;
} }
if ( isset( $object['user_id'] ) ) { // only send minimal data
unset( $object['user_id'] ); $object = array_intersect_key(
} $object,
array_flip(
unset( $object['@context'] ); array(
'id',
'type',
'actor',
'object',
)
)
);
$user = Users::get_by_id( $user_id ); $user = Users::get_by_id( $user_id );
@ -282,7 +289,7 @@ class Followers {
$activity->set_object( $object ); $activity->set_object( $object );
$activity->set_actor( $user->get_id() ); $activity->set_actor( $user->get_id() );
$activity->set_to( $actor ); $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(); $activity = $activity->to_json();