From 8f28cb3fb49cb0631863594b05b6135cd5b7b272 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 9 Apr 2019 22:35:49 -0600 Subject: [PATCH] Update AP Note transformers, thanks kaniini --- app/Transformer/ActivityPub/Verb/CreateNote.php | 10 ++++++++++ app/Transformer/ActivityPub/Verb/Note.php | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/app/Transformer/ActivityPub/Verb/CreateNote.php b/app/Transformer/ActivityPub/Verb/CreateNote.php index c30a2cb8c..b5f51d769 100644 --- a/app/Transformer/ActivityPub/Verb/CreateNote.php +++ b/app/Transformer/ActivityPub/Verb/CreateNote.php @@ -35,6 +35,11 @@ class CreateNote extends Fractal\TransformerAbstract 'Hashtag' => 'as:Hashtag', 'sensitive' => 'as:sensitive', 'commentsEnabled' => 'sc:Boolean', + 'capabilities' => [ + 'announce' => ['@type' => '@id'], + 'like' => ['@type' => '@id'], + 'reply' => ['@type' => '@id'] + ] ] ], 'id' => $status->permalink(), @@ -65,6 +70,11 @@ class CreateNote extends Fractal\TransformerAbstract })->toArray(), 'tag' => $tags, 'commentsEnabled' => (bool) !$status->comments_disabled, + 'capabilities' => [ + 'announce' => 'https://www.w3.org/ns/activitystreams#Public', + 'like' => 'https://www.w3.org/ns/activitystreams#Public', + 'reply' => $status->comments_disabled == true ? null : 'https://www.w3.org/ns/activitystreams#Public' + ] ] ]; } diff --git a/app/Transformer/ActivityPub/Verb/Note.php b/app/Transformer/ActivityPub/Verb/Note.php index 3dafe32aa..ac4567179 100644 --- a/app/Transformer/ActivityPub/Verb/Note.php +++ b/app/Transformer/ActivityPub/Verb/Note.php @@ -35,6 +35,11 @@ class Note extends Fractal\TransformerAbstract 'Hashtag' => 'as:Hashtag', 'sensitive' => 'as:sensitive', 'commentsEnabled' => 'sc:Boolean', + 'capabilities' => [ + 'announce' => ['@type' => '@id'], + 'like' => ['@type' => '@id'], + 'reply' => ['@type' => '@id'], + ] ] ], 'id' => $status->url(), @@ -58,6 +63,11 @@ class Note extends Fractal\TransformerAbstract })->toArray(), 'tag' => $tags, 'commentsEnabled' => (bool) !$status->comments_disabled, + 'capabilities' => [ + 'announce' => 'https://www.w3.org/ns/activitystreams#Public', + 'like' => 'https://www.w3.org/ns/activitystreams#Public', + 'reply' => $status->comments_disabled == true ? null : 'https://www.w3.org/ns/activitystreams#Public' + ] ]; } }