1
0
Fork 0

Update ApiV1Controller, fix public timeline endpoint

This commit is contained in:
Daniel Supernault 2022-01-09 19:30:53 -07:00
parent 7aea7e80e6
commit 80c7def3df
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 6 additions and 1 deletions

View File

@ -1794,6 +1794,10 @@ class ApiV1Controller extends Controller
$res = collect($feed)
->map(function($k) use($user) {
$status = StatusService::getMastodon($k);
if(!$status || !isset($status['account']) || !isset($status['account']['id'])) {
return false;
}
if($user) {
$status['favourited'] = (bool) LikeService::liked($user->profile_id, $k);
$status['relationship'] = RelationshipService::get($user->profile_id, $status['account']['id']);
@ -1801,8 +1805,9 @@ class ApiV1Controller extends Controller
return $status;
})
->filter(function($s) use($filtered) {
return in_array($s['account']['id'], $filtered) == false;
return $s && isset($s['account']) && in_array($s['account']['id'], $filtered) == false;
})
->values()
->toArray();
return response()->json($res);
}