fix(activitypub): add target_actor_id for create activity to broadcast post reply

This commit is contained in:
Yassine Doghri 2022-02-03 12:11:01 +00:00
parent 962dd305f5
commit 0128a21ec5
3 changed files with 11 additions and 7 deletions

View File

@ -28,12 +28,14 @@ class SchedulerController extends Controller
// Send activity to all followers
foreach ($scheduledActivities as $scheduledActivity) {
if ($scheduledActivity->target_actor_id !== null) {
// send activity to targeted actor
send_activity_to_actor(
$scheduledActivity->actor,
$scheduledActivity->targetActor,
json_encode($scheduledActivity->payload, JSON_THROW_ON_ERROR)
);
if ($scheduledActivity->actor_id !== $scheduledActivity->target_actor_id) {
// send activity to targeted actor
send_activity_to_actor(
$scheduledActivity->actor,
$scheduledActivity->targetActor,
json_encode($scheduledActivity->payload, JSON_THROW_ON_ERROR)
);
}
} else {
// send activity to all actor followers
send_activity_to_followers(

View File

@ -299,7 +299,7 @@ class PostModel extends BaseUuidModel
->newActivity(
'Create',
$post->actor_id,
null,
$post->in_reply_to_id === null ? null : $post->reply_to_post->actor_id,
$newPostId,
$createActivity->toJSON(),
$post->published_at,

View File

@ -39,6 +39,8 @@ class NoteObject extends ObjectType
$this->attributedTo = $post->actor->uri;
if ($post->in_reply_to_id !== null) {
$this->to[] = $post->reply_to_post->actor->uri;
$this->inReplyTo = $post->reply_to_post->uri;
}