Merge pull request #3143 from pixelfed/staging

Staging
This commit is contained in:
daniel 2022-01-09 19:33:41 -07:00 committed by GitHub
commit 535a0e63ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View file

@ -90,6 +90,8 @@
- Updated AccountController, refresh RelationshipService on mute/block. ([6f1b0245](https://github.com/pixelfed/pixelfed/commit/6f1b0245)) - Updated AccountController, refresh RelationshipService on mute/block. ([6f1b0245](https://github.com/pixelfed/pixelfed/commit/6f1b0245))
- Updated ApiV1Controller, fix version on instance endpoint. ([a6261221](https://github.com/pixelfed/pixelfed/commit/a6261221)) - Updated ApiV1Controller, fix version on instance endpoint. ([a6261221](https://github.com/pixelfed/pixelfed/commit/a6261221))
- Updated components, fix api endpoints. Fixes #3138. ([e724633e](https://github.com/pixelfed/pixelfed/commit/e724633e)) - Updated components, fix api endpoints. Fixes #3138. ([e724633e](https://github.com/pixelfed/pixelfed/commit/e724633e))
- Updated ApiV1Controller, fix public timeline endpoint. ([80c7def3](https://github.com/pixelfed/pixelfed/commit/80c7def3))
- Updated PublicApiController, fix public timeline endpoint. ([dcb7ba9c](https://github.com/pixelfed/pixelfed/commit/dcb7ba9c))
- ([](https://github.com/pixelfed/pixelfed/commit/)) - ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.11.1 (2021-09-07)](https://github.com/pixelfed/pixelfed/compare/v0.11.0...v0.11.1) ## [v0.11.1 (2021-09-07)](https://github.com/pixelfed/pixelfed/compare/v0.11.0...v0.11.1)

View file

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

View file

@ -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'])