Skip to content
Snippets Groups Projects
Commit 0128a21e authored by Yassine Doghri's avatar Yassine Doghri
Browse files

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

parent 962dd305
No related branches found
No related tags found
No related merge requests found
......@@ -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(
......
......@@ -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,
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment