Kaynağa Gözat

Update AP Note transformers, thanks kaniini

Daniel Supernault 6 yıl önce
ebeveyn
işleme
8f28cb3fb4

+ 10 - 0
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'
+				]
 			]
 		];
 	}

+ 10 - 0
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'
+			]
 		];
 	}
 }