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

Update ApiV1Controller, hydrate reblog state in home timeline

This commit is contained in:
Daniel Supernault 2023-07-30 05:16:51 -06:00
parent 685d45a8df
commit 13bdaa2ed4
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -2199,6 +2199,14 @@ class ApiV1Controller extends Controller
->filter(function($status) {
return $status && isset($status['account']);
})
->map(function($status) use($pid) {
if(!empty($status['reblog'])) {
$status['reblog']['favourited'] = (bool) LikeService::liked($pid, $status['reblog']['id']);
$status['reblog']['reblogged'] = (bool) ReblogService::get($pid, $status['reblog']['id']);
}
return $status;
})
->take($limit)
->values();
} else {
@ -2242,6 +2250,14 @@ class ApiV1Controller extends Controller
->filter(function($status) {
return $status && isset($status['account']);
})
->map(function($status) use($pid) {
if(!empty($status['reblog'])) {
$status['reblog']['favourited'] = (bool) LikeService::liked($pid, $status['reblog']['id']);
$status['reblog']['reblogged'] = (bool) ReblogService::get($pid, $status['reblog']['id']);
}
return $status;
})
->take($limit)
->values();
}