Update PublicApiController, fix edge case in timeline pagination

pull/3352/head
Daniel Supernault 2022-04-03 00:50:25 -06:00
rodzic aa4b011e25
commit 9a7289198a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 0DEF1C662C9033F7
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -378,7 +378,7 @@ class PublicApiController extends Controller
return $status; return $status;
}) })
->filter(function($s) use($filtered) { ->filter(function($s) use($filtered) {
return $s && in_array($s['account']['id'], $filtered) == false; return $s && isset($s['account']) && in_array($s['account']['id'], $filtered) == false;
}) })
->values(); ->values();
@ -402,7 +402,7 @@ class PublicApiController extends Controller
$res = collect($feed) $res = collect($feed)
->map(function($k) use($user) { ->map(function($k) use($user) {
$status = StatusService::get($k); $status = StatusService::get($k);
if($user) { if($status && isset($status['account']) && $user) {
$status['favourited'] = (bool) LikeService::liked($user->profile_id, $k); $status['favourited'] = (bool) LikeService::liked($user->profile_id, $k);
$status['bookmarked'] = (bool) BookmarkService::get($user->profile_id, $k); $status['bookmarked'] = (bool) BookmarkService::get($user->profile_id, $k);
$status['reblogged'] = (bool) ReblogService::get($user->profile_id, $k); $status['reblogged'] = (bool) ReblogService::get($user->profile_id, $k);
@ -411,7 +411,7 @@ class PublicApiController extends Controller
return $status; return $status;
}) })
->filter(function($s) use($filtered) { ->filter(function($s) use($filtered) {
return isset($s['account']) && in_array($s['account']['id'], $filtered) == false; return $s && isset($s['account']) && in_array($s['account']['id'], $filtered) == false;
}) })
->values() ->values()
->toArray(); ->toArray();