Browse Source

Update PublicApiController, fix public timeline endpoint

Daniel Supernault 3 years ago
parent
commit
dcb7ba9c7a
1 changed files with 6 additions and 1 deletions
  1. 6 1
      app/Http/Controllers/PublicApiController.php

+ 6 - 1
app/Http/Controllers/PublicApiController.php

@@ -323,6 +323,9 @@ class PublicApiController extends Controller
                           ->get()
                           ->get()
                           ->map(function($s) use ($user) {
                           ->map(function($s) use ($user) {
                                $status = StatusService::getFull($s->id, $user->profile_id);
                                $status = StatusService::getFull($s->id, $user->profile_id);
+                               if(!$status) {
+                               		return false;
+                               }
                                $status['favourited'] = (bool) LikeService::liked($user->profile_id, $s->id);
                                $status['favourited'] = (bool) LikeService::liked($user->profile_id, $s->id);
                                return $status;
                                return $status;
                           })
                           })
@@ -362,6 +365,9 @@ class PublicApiController extends Controller
                           ->get()
                           ->get()
                           ->map(function($s) use ($user) {
                           ->map(function($s) use ($user) {
                                $status = StatusService::getFull($s->id, $user->profile_id);
                                $status = StatusService::getFull($s->id, $user->profile_id);
+                               if(!$status) {
+                               		return false;
+                               }
                                $status['favourited'] = (bool) LikeService::liked($user->profile_id, $s->id);
                                $status['favourited'] = (bool) LikeService::liked($user->profile_id, $s->id);
                                return $status;
                                return $status;
                           })
                           })
@@ -777,7 +783,6 @@ class PublicApiController extends Controller
                 $visibility = ['public', 'unlisted'];
                 $visibility = ['public', 'unlisted'];
             }
             }
         }
         }
-
         $dir = $min_id ? '>' : '<';
         $dir = $min_id ? '>' : '<';
         $id = $min_id ?? $max_id;
         $id = $min_id ?? $max_id;
         $res = Status::whereProfileId($profile['id'])
         $res = Status::whereProfileId($profile['id'])