Prechádzať zdrojové kódy

Update AP Note transformers, add location/place

Daniel Supernault 5 rokov pred
rodič
commit
92b6204c66

+ 7 - 0
app/Transformer/ActivityPub/StatusTransformer.php

@@ -54,6 +54,13 @@ class StatusTransformer extends Fractal\TransformerAbstract
             ];
           }),
           'tag' => [],
+          'location' => $status->place_id ? [
+              'type' => 'Place',
+              'name' => $status->place->name,
+              'longitude' => $status->place->long,
+              'lattitude' => $status->place->lat,
+              'country' => $status->place->country
+            ] : null,
       ];
     }
 }

+ 8 - 1
app/Transformer/ActivityPub/Verb/CreateNote.php

@@ -74,7 +74,14 @@ class CreateNote extends Fractal\TransformerAbstract
 					'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'
-				]
+				],
+				'location' => $status->place_id ? [
+						'type' => 'Place',
+						'name' => $status->place->name,
+						'longitude' => $status->place->long,
+						'lattitude' => $status->place->lat,
+						'country' => $status->place->country
+					] : null,
 			]
 		];
 	}

+ 8 - 1
app/Transformer/ActivityPub/Verb/Note.php

@@ -67,7 +67,14 @@ class Note extends Fractal\TransformerAbstract
 				'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'
-			]
+			],
+			'location' => $status->place_id ? [
+					'type' => 'Place',
+					'name' => $status->place->name,
+					'longitude' => $status->place->long,
+					'lattitude' => $status->place->lat,
+					'country' => $status->place->country
+				] : null,
 		];
 	}
 }