Browse Source

Update Status Model

Daniel Supernault 6 years ago
parent
commit
7691da69a9
1 changed files with 8 additions and 6 deletions
  1. 8 6
      app/Status.php

+ 8 - 6
app/Status.php

@@ -113,7 +113,7 @@ class Status extends Model
     public function bookmarked()
     public function bookmarked()
     {
     {
         if (!Auth::check()) {
         if (!Auth::check()) {
-            return 0;
+            return false;
         }
         }
         $profile = Auth::user()->profile;
         $profile = Auth::user()->profile;
 
 
@@ -139,7 +139,7 @@ class Status extends Model
     {
     {
         $parent = $this->in_reply_to_id ?? $this->reblog_of_id;
         $parent = $this->in_reply_to_id ?? $this->reblog_of_id;
         if (!empty($parent)) {
         if (!empty($parent)) {
-            return self::findOrFail($parent);
+            return $this->findOrFail($parent);
         }
         }
     }
     }
 
 
@@ -254,7 +254,7 @@ class Status extends Model
                         'url' => $media->url(),
                         'url' => $media->url(),
                         'name' => null
                         'name' => null
                     ];
                     ];
-                })
+                })->toArray()
             ]
             ]
         ];
         ];
     }
     }
@@ -268,14 +268,16 @@ class Status extends Model
         $res['to'] = [];
         $res['to'] = [];
         $res['cc'] = [];
         $res['cc'] = [];
         $scope = $this->scope;
         $scope = $this->scope;
+        $mentions = $this->mentions->map(function ($mention) {
+            return $mention->permalink();
+        })->toArray();
+
         switch ($scope) {
         switch ($scope) {
             case 'public':
             case 'public':
                 $res['to'] = [
                 $res['to'] = [
                     "https://www.w3.org/ns/activitystreams#Public"
                     "https://www.w3.org/ns/activitystreams#Public"
                 ];
                 ];
-                $res['cc'] = [
-                    $this->profile->permalink('/followers')
-                ];
+                $res['cc'] = array_merge([$this->profile->permalink('/followers')], $mentions);
                 break;
                 break;
             
             
             default:
             default: