1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-25 09:17:03 +00:00

Hydrate favourited and reblogged state on v1 context endpoint

This commit is contained in:
Daniel Supernault 2022-07-25 23:35:44 -06:00
parent 6d52550ee1
commit abb4f7e1ec
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -2208,6 +2208,7 @@ class ApiV1Controller extends Controller
abort_if(!$request->user(), 403);
$user = $request->user();
$pid = $user->profile_id;
$status = StatusService::getMastodon($id, false);
if(!$status || !isset($status['account'])) {
@ -2244,6 +2245,11 @@ class ApiV1Controller extends Controller
->filter(function($post) {
return $post && isset($post['account']);
})
->map(function($status) use($pid) {
$status['favourited'] = LikeService::liked($pid, $status['id']);
$status['reblogged'] = ReblogService::get($pid, $status['id']);
return $status;
})
->values();
}