diff --git a/app/Transformer/ActivityPub/Verb/CreateNote.php b/app/Transformer/ActivityPub/Verb/CreateNote.php index e565ad9e..5bd71284 100644 --- a/app/Transformer/ActivityPub/Verb/CreateNote.php +++ b/app/Transformer/ActivityPub/Verb/CreateNote.php @@ -22,6 +22,23 @@ class CreateNote extends Fractal\TransformerAbstract 'name' => $name ]; })->toArray(); + + if($status->in_reply_to_id != null) { + $parent = $status->parent()->profile; + if($parent) { + $webfinger = $parent->emailUrl(); + $name = Str::startsWith($webfinger, '@') ? + $webfinger : + '@' . $webfinger; + $reply = [ + 'type' => 'Mention', + 'href' => $parent->permalink(), + 'name' => $name + ]; + $mentions = array_merge($reply, $mentions); + } + } + $hashtags = $status->hashtags->map(function ($hashtag) { return [ 'type' => 'Hashtag', diff --git a/app/Transformer/ActivityPub/Verb/Note.php b/app/Transformer/ActivityPub/Verb/Note.php index 98c2dec1..f58ca6f4 100644 --- a/app/Transformer/ActivityPub/Verb/Note.php +++ b/app/Transformer/ActivityPub/Verb/Note.php @@ -22,6 +22,23 @@ class Note extends Fractal\TransformerAbstract 'name' => $name ]; })->toArray(); + + if($status->in_reply_to_id != null) { + $parent = $status->parent()->profile; + if($parent) { + $webfinger = $parent->emailUrl(); + $name = Str::startsWith($webfinger, '@') ? + $webfinger : + '@' . $webfinger; + $reply = [ + 'type' => 'Mention', + 'href' => $parent->permalink(), + 'name' => $name + ]; + $mentions = array_merge($reply, $mentions); + } + } + $hashtags = $status->hashtags->map(function ($hashtag) { return [ 'type' => 'Hashtag',