Quellcode durchsuchen

Update AP ProfileTransformer

Daniel Supernault vor 7 Jahren
Ursprung
Commit
7f789ad508
1 geänderte Dateien mit 11 neuen und 4 gelöschten Zeilen
  1. 11 4
      app/Transformer/ActivityPub/ProfileTransformer.php

+ 11 - 4
app/Transformer/ActivityPub/ProfileTransformer.php

@@ -11,7 +11,14 @@ class ProfileTransformer extends Fractal\TransformerAbstract
   public function transform(Profile $profile)
   {
       return [
-          '@context' => 'https://www.w3.org/ns/activitystreams',
+          '@context' => [
+            'https://www.w3.org/ns/activitystreams',
+            'https://w3id.org/security/v1',
+            [
+              "manuallyApprovesFollowers" => "as:manuallyApprovesFollowers",
+              "featured" => 'https://pixelfed.org/ns/featured',
+            ]
+          ],
           'id' => $profile->permalink(),
           'type' => 'Person',
           'following' => $profile->permalink('/following'),
@@ -23,9 +30,9 @@ class ProfileTransformer extends Fractal\TransformerAbstract
           'name'  => $profile->name,
           'summary' => $profile->bio,
           'url' => $profile->url(),
-          'manuallyApprovesFollowers' => $profile->is_private,
-          'follower_count' => $profile->followers()->count(),
-          'following_count' => $profile->following()->count(),
+          'manuallyApprovesFollowers' => (bool) $profile->is_private,
+          // 'follower_count' => $profile->followers()->count(),
+          // 'following_count' => $profile->following()->count(),
           'publicKey' => [
             'id' => $profile->permalink() . '#main-key',
             'owner' => $profile->permalink(),