diff --git a/includes/client/comments.php b/includes/client/comments.php index 4547264..82739cc 100644 --- a/includes/client/comments.php +++ b/includes/client/comments.php @@ -138,7 +138,7 @@ function get_comment_to( $comment, $followers_id ) { 'https://www.w3.org/ns/activitystreams#Public', $followers_id, ); - $to = array_unique( array_merge( $to, traverse_reply_chain( $comment ) ) ); + $to = array_values( array_unique( array_merge( $to, traverse_reply_chain( $comment ) ) ) ); return $to; } @@ -164,8 +164,17 @@ function traverse_reply_chain_helper( $object, $depth, $acc ) { $recipients = array_unique( array_merge( $recipients, $new_recipients ) ); } } + if ( array_key_exists( 'attributedTo', $parent ) ) { + $attributed_to = \pterotype\util\dereference_object( $parent['attributedTo'] ); + $recipients[] = $attributed_to['id']; + } + if ( array_key_exists( 'actor', $parent ) ) { + $actor = \pterotype\util\dereference_object( $parent['actor'] ); + $recipients[] = $actor['id']; + } + $recipients = array_values( array_unique( $recipients ) ); return traverse_reply_chain_helper( - $parent, $depth + 1, array_unique( array_merge( $acc, $recipients ) ) + $parent, $depth + 1, array_values( array_unique( array_merge( $acc, $recipients ) ) ) ); } ?> diff --git a/includes/server/deliver.php b/includes/server/deliver.php index 556f452..467b171 100644 --- a/includes/server/deliver.php +++ b/includes/server/deliver.php @@ -18,7 +18,7 @@ function deliver_activity( $actor_slug, $activity ) { $recipients, retrieve_recipients_for_field( $field, $activity ) ); } - $recipients = array_unique( $recipients ); + $recipients = array_values( array_unique( $recipients ) ); if ( array_key_exists( 'actor', $activity ) ) { $actor = \pterotype\util\dereference_object( $activity['actor'] ); $recipients = remove_actor_inbox_from_recipients( $actor, $recipients );