1
0
Fork 0
forked from mirror/pixelfed

Update PublicApiController, add bookmark state to timeline endpoints

This commit is contained in:
Daniel Supernault 2022-01-27 05:11:34 -07:00
parent 34a3d65f30
commit c0b1e0427e
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -27,6 +27,7 @@ use App\Transformer\Api\{
};
use App\Services\{
AccountService,
BookmarkService,
FollowerService,
LikeService,
PublicTimelineService,
@ -327,6 +328,7 @@ class PublicApiController extends Controller
return false;
}
$status['favourited'] = (bool) LikeService::liked($user->profile_id, $s->id);
$status['bookmarked'] = (bool) BookmarkService::get($user->profile_id, $s->id);
return $status;
})
->filter(function($s) use($filtered) {
@ -369,6 +371,7 @@ class PublicApiController extends Controller
return false;
}
$status['favourited'] = (bool) LikeService::liked($user->profile_id, $s->id);
$status['bookmarked'] = (bool) BookmarkService::get($user->profile_id, $s->id);
return $status;
})
->filter(function($s) use($filtered) {
@ -398,6 +401,8 @@ class PublicApiController extends Controller
$status = StatusService::get($k);
if($user) {
$status['favourited'] = (bool) LikeService::liked($user->profile_id, $k);
$status['bookmarked'] = (bool) BookmarkService::get($user->profile_id, $k);
$status['relationship'] = RelationshipService::get($user->profile_id, $status['account']['id']);
}
return $status;